public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] GCC system.h and Graphite header order
@ 2015-11-21 22:17 David Edelsohn
  2015-11-22  7:34 ` Sebastian Pop
  0 siblings, 1 reply; 7+ messages in thread
From: David Edelsohn @ 2015-11-21 22:17 UTC (permalink / raw)
  To: Sebastian Pop, Richard Biener; +Cc: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 1217 bytes --]

Graphite relies on the ISL library and includes multiple ISL headers.
The ISL headers refer to identifiers that are poisoned for use in GCC.
The source files for Graphite were organized to include the ISL
headers first, to avoid the identifier poisoning, which breaks some
platforms because GCC header features are disabled.

This patch reorganizes the graphite*.c header file inclusion order to
list ISL header files near the end, just before the graphite header
files on which they rely.  A new macro, USES_ISL, is defined, which
skips the relevant identifier poisoning, similar to logic for Flex and
Bison.

This patch also removes early inclusion of stddef.h for ISL because it
now should be provided by GCC system.h

This has been bootstrapped on powerpc-ibm-aix7.1.0.0

Okay for trunk?

Thanks, David

* system.h: Don't poison calloc and strdup if USES_ISL is defined.
* graphite-dependences.c: Define USES_ISL.  Include ISL header files
after GCC header files and before graphite header files.
* graphite-dependences.c: Same.
* graphite-isl-ast-to-gimple.c: Same.
* graphite-optimize-isl.c: Same.
* graphite-poly.c: Same.
* graphite-scop-detection.c: Same.
* graphite-sese-to-poly.c: Same.
* graphite.c: Same.

[-- Attachment #2: GG --]
[-- Type: application/octet-stream, Size: 9768 bytes --]

Index: system.h
===================================================================
--- system.h	(revision 230704)
+++ system.h	(working copy)
@@ -798,9 +798,12 @@
    compiling gcc, so that the autoconf declaration tests for malloc
    etc don't spuriously fail.  */
 #ifdef IN_GCC
+
+#ifndef USES_ISL
 #undef calloc
 #undef strdup
  #pragma GCC poison calloc strdup
+#endif
 
 #if !defined(FLEX_SCANNER) && !defined(YYBISON)
 #undef malloc
Index: graphite-dependences.c
===================================================================
--- graphite-dependences.c	(revision 230704)
+++ graphite-dependences.c	(working copy)
@@ -19,19 +19,12 @@
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define USES_ISL
+
 #include "config.h"
 
 #ifdef HAVE_isl
-/* Workaround for GMP 5.1.3 bug, see PR56019.  */
-#include <stddef.h>
 
-#include <isl/constraint.h>
-#include <isl/set.h>
-#include <isl/map.h>
-#include <isl/union_map.h>
-#include <isl/flow.h>
-#include <isl/constraint.h>
-
 #include "system.h"
 #include "coretypes.h"
 #include "backend.h"
@@ -44,6 +37,14 @@
 #include "tree-pass.h"
 #include "cfgloop.h"
 #include "tree-data-ref.h"
+
+#include <isl/constraint.h>
+#include <isl/set.h>
+#include <isl/map.h>
+#include <isl/union_map.h>
+#include <isl/flow.h>
+#include <isl/constraint.h>
+
 #include "graphite-poly.h"
 
 
Index: graphite-isl-ast-to-gimple.c
===================================================================
--- graphite-isl-ast-to-gimple.c	(revision 230704)
+++ graphite-isl-ast-to-gimple.c	(working copy)
@@ -18,28 +18,12 @@
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define USES_ISL
+
 #include "config.h"
 
 #ifdef HAVE_isl
-/* Workaround for GMP 5.1.3 bug, see PR56019.  */
-#include <stddef.h>
 
-#include <isl/constraint.h>
-#include <isl/set.h>
-#include <isl/union_set.h>
-#include <isl/map.h>
-#include <isl/union_map.h>
-#include <isl/ast_build.h>
-
-/* Since ISL-0.13, the extern is in val_gmp.h.  */
-#if !defined(HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE) && defined(__cplusplus)
-extern "C" {
-#endif
-#include <isl/val_gmp.h>
-#if !defined(HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE) && defined(__cplusplus)
-}
-#endif
-
 #include "system.h"
 #include "coretypes.h"
 #include "backend.h"
@@ -59,19 +43,36 @@
 #include "tree-pass.h"
 #include "cfgloop.h"
 #include "tree-data-ref.h"
-#include "graphite-poly.h"
 #include "tree-ssa-loop-manip.h"
 #include "tree-scalar-evolution.h"
 #include "gimple-ssa.h"
 #include "tree-phinodes.h"
 #include "tree-into-ssa.h"
 #include "ssa-iterators.h"
-#include "graphite-isl-ast-to-gimple.h"
 #include "tree-cfg.h"
 #include "gimple-pretty-print.h"
 #include "cfganal.h"
 #include "value-prof.h"
 
+#include <isl/constraint.h>
+#include <isl/set.h>
+#include <isl/union_set.h>
+#include <isl/map.h>
+#include <isl/union_map.h>
+#include <isl/ast_build.h>
+
+/* Since ISL-0.13, the extern is in val_gmp.h.  */
+#if !defined(HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE) && defined(__cplusplus)
+extern "C" {
+#endif
+#include <isl/val_gmp.h>
+#if !defined(HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE) && defined(__cplusplus)
+}
+#endif
+
+#include "graphite-poly.h"
+#include "graphite-isl-ast-to-gimple.h"
+
 #include <map>
 
 /* We always try to use signed 128 bit types, but fall back to smaller types
Index: graphite-optimize-isl.c
===================================================================
--- graphite-optimize-isl.c	(revision 230704)
+++ graphite-optimize-isl.c	(working copy)
@@ -18,12 +18,26 @@
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define USES_ISL
+
 #include "config.h"
 
 #ifdef HAVE_isl
-/* Workaround for GMP 5.1.3 bug, see PR56019.  */
-#include <stddef.h>
 
+#include "system.h"
+#include "coretypes.h"
+#include "backend.h"
+#include "cfghooks.h"
+#include "tree.h"
+#include "gimple.h"
+#include "fold-const.h"
+#include "gimple-iterator.h"
+#include "tree-ssa-loop.h"
+#include "cfgloop.h"
+#include "tree-data-ref.h"
+#include "params.h"
+#include "dumpfile.h"
+
 #include <isl/constraint.h>
 #include <isl/set.h>
 #include <isl/union_set.h>
@@ -38,20 +52,7 @@
 #include <isl/schedule_node.h>
 #endif
 
-#include "system.h"
-#include "coretypes.h"
-#include "backend.h"
-#include "cfghooks.h"
-#include "tree.h"
-#include "gimple.h"
-#include "fold-const.h"
-#include "gimple-iterator.h"
-#include "tree-ssa-loop.h"
-#include "cfgloop.h"
-#include "tree-data-ref.h"
 #include "graphite-poly.h"
-#include "params.h"
-#include "dumpfile.h"
 
 #ifdef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS
 
Index: graphite-poly.c
===================================================================
--- graphite-poly.c	(revision 230704)
+++ graphite-poly.c	(working copy)
@@ -19,12 +19,26 @@
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define USES_ISL
+
 #include "config.h"
 
 #ifdef HAVE_isl
-/* Workaround for GMP 5.1.3 bug, see PR56019.  */
-#include <stddef.h>
 
+#include "system.h"
+#include "coretypes.h"
+#include "backend.h"
+#include "tree.h"
+#include "gimple.h"
+#include "cfghooks.h"
+#include "gimple-pretty-print.h"
+#include "diagnostic-core.h"
+#include "fold-const.h"
+#include "gimple-iterator.h"
+#include "tree-ssa-loop.h"
+#include "cfgloop.h"
+#include "tree-data-ref.h"
+
 #include <isl/constraint.h>
 #include <isl/set.h>
 #include <isl/map.h>
@@ -43,19 +57,6 @@
 }
 #endif
 
-#include "system.h"
-#include "coretypes.h"
-#include "backend.h"
-#include "tree.h"
-#include "gimple.h"
-#include "cfghooks.h"
-#include "gimple-pretty-print.h"
-#include "diagnostic-core.h"
-#include "fold-const.h"
-#include "gimple-iterator.h"
-#include "tree-ssa-loop.h"
-#include "cfgloop.h"
-#include "tree-data-ref.h"
 #include "graphite-poly.h"
 
 #define OPENSCOP_MAX_STRING 256
Index: graphite-scop-detection.c
===================================================================
--- graphite-scop-detection.c	(revision 230704)
+++ graphite-scop-detection.c	(working copy)
@@ -19,17 +19,12 @@
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define USES_ISL
+
 #include "config.h"
 
 #ifdef HAVE_isl
-/* Workaround for GMP 5.1.3 bug, see PR56019.  */
-#include <stddef.h>
 
-#include <isl/constraint.h>
-#include <isl/set.h>
-#include <isl/map.h>
-#include <isl/union_map.h>
-
 #include "system.h"
 #include "coretypes.h"
 #include "backend.h"
@@ -51,11 +46,17 @@
 #include "tree-data-ref.h"
 #include "tree-scalar-evolution.h"
 #include "tree-pass.h"
-#include "graphite-poly.h"
 #include "tree-ssa-propagate.h"
-#include "graphite-scop-detection.h"
 #include "gimple-pretty-print.h"
 
+#include <isl/constraint.h>
+#include <isl/set.h>
+#include <isl/map.h>
+#include <isl/union_map.h>
+
+#include "graphite-poly.h"
+#include "graphite-scop-detection.h"
+
 class debug_printer
 {
 private:
Index: graphite-sese-to-poly.c
===================================================================
--- graphite-sese-to-poly.c	(revision 230704)
+++ graphite-sese-to-poly.c	(working copy)
@@ -18,29 +18,12 @@
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define USES_ISL
+
 #include "config.h"
 
 #ifdef HAVE_isl
-/* Workaround for GMP 5.1.3 bug, see PR56019.  */
-#include <stddef.h>
 
-#include <isl/constraint.h>
-#include <isl/set.h>
-#include <isl/map.h>
-#include <isl/union_map.h>
-#include <isl/constraint.h>
-#include <isl/aff.h>
-#include <isl/val.h>
-
-/* Since ISL-0.13, the extern is in val_gmp.h.  */
-#if !defined(HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE) && defined(__cplusplus)
-extern "C" {
-#endif
-#include <isl/val_gmp.h>
-#if !defined(HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE) && defined(__cplusplus)
-}
-#endif
-
 #include "system.h"
 #include "coretypes.h"
 #include "backend.h"
@@ -63,8 +46,26 @@
 #include "tree-data-ref.h"
 #include "tree-scalar-evolution.h"
 #include "domwalk.h"
+#include "tree-ssa-propagate.h"
+
+#include <isl/constraint.h>
+#include <isl/set.h>
+#include <isl/map.h>
+#include <isl/union_map.h>
+#include <isl/constraint.h>
+#include <isl/aff.h>
+#include <isl/val.h>
+
+/* Since ISL-0.13, the extern is in val_gmp.h.  */
+#if !defined(HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE) && defined(__cplusplus)
+extern "C" {
+#endif
+#include <isl/val_gmp.h>
+#if !defined(HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE) && defined(__cplusplus)
+}
+#endif
+
 #include "graphite-poly.h"
-#include "tree-ssa-propagate.h"
 #include "graphite-sese-to-poly.h"
 
 /* Assigns to RES the value of the INTEGER_CST T.  */
Index: graphite.c
===================================================================
--- graphite.c	(revision 230704)
+++ graphite.c	(working copy)
@@ -27,19 +27,9 @@
    The wiki page http://gcc.gnu.org/wiki/Graphite contains pointers to
    the related work.  */
 
-#include "config.h"
+#define USES_ISL
 
-#ifdef HAVE_isl
-/* Workaround for GMP 5.1.3 bug, see PR56019.  */
-#include <stddef.h>
-
-#include <isl/constraint.h>
-#include <isl/set.h>
-#include <isl/map.h>
-#include <isl/options.h>
-#include <isl/union_map.h>
-#endif
-
+#include "config.h"
 #include "system.h"
 #include "coretypes.h"
 #include "backend.h"
@@ -59,10 +49,17 @@
 #include "tree-ssa-loop.h"
 #include "tree-data-ref.h"
 #include "tree-scalar-evolution.h"
-#include "graphite-poly.h"
 #include "dbgcnt.h"
 #include "tree-parloops.h"
 #include "tree-cfgcleanup.h"
+
+#include <isl/constraint.h>
+#include <isl/set.h>
+#include <isl/map.h>
+#include <isl/options.h>
+#include <isl/union_map.h>
+
+#include "graphite-poly.h"
 #include "graphite-scop-detection.h"
 #include "graphite-isl-ast-to-gimple.h"
 #include "graphite-sese-to-poly.h"

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-11-30  8:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-21 22:17 [PATCH] GCC system.h and Graphite header order David Edelsohn
2015-11-22  7:34 ` Sebastian Pop
2015-11-23 10:28   ` Richard Biener
2015-11-24 10:39     ` Alan Lawrence
2015-11-27 16:40       ` Thomas Schwinge
2015-11-27 17:05         ` David Edelsohn
2015-11-30  8:30           ` Thomas Schwinge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).