This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch, Fortran] Minor include-file cleanup


This patch does a minor cleanup:

a) Do not include toplev.h in openmp.c,  trans-stmt.c and primary.c
(As its declarations are unused.)

b) gfortran.h: Do not include system.h and add it to the few remaining
files explicitly (bbt.c, data.c, dependency.c, dump-parse-tree.c).
This is kind  of a no op, except that one does not include the file
twice - explicitly in *.c and implicitly through gfortran.h. (If one
wants to keep it only in gfortran.h, one needs to move its inclusion up
in some files as other included .h files already need the declarations
of system.h.)

c) Do not include gfortran.h and/or splay-tree.h in arith.h,
constructor.h, match.h, parse.h, target-memory.h.
Also kind of a no op: All *.c files include gfortran.h and (if needed)
splay-tree.h explicitly, thus one does not need to add them additionally
through .h files.

d) Annotate why toplev.h is still needed (several *.c)
The reason is mostly because of sorry and fatal_error.

Build on x86-64-linux.
OK for the trunk?

Tobias
2010-05-21  Tobias Burnus  <burnus@net-b.de>

        * gfortran.h: Do not include system.h.
        * bbt.c: Include system.h.
        * data.c: Ditto.
        * dependency.c: Ditto.
        * dump-parse-tree.c: Ditto.
        * arith.h: Do not include gfortran.h.
        * constructor.h: Do not include gfortran.h and splay-tree.h.
        * match.h: Do not include gfortran.h.
        * parse.h: Ditto.
        * target-memory.h: Ditto.
	* openmp.c: Do not include toplev.h.
	* trans-stmt.c: Ditto.
	* primary.c: Ditto.
	* trans-expr.c: Tell why toplev.h is needed.
	* trans-array.c: Ditto.
	* trans-common.c: Ditto.
	* trans-openmp.c: Ditto.
	* trans-const.c: Ditto.
	* trans.c: Ditto.
	* trans-types.c: Ditto.
	* trans-io.c: Ditto.
	* trans-decl.c: Ditto.
	* scanner.c: Ditto.
	* convert.c: Ditto.
	* trans-intrinsic.c: Ditto.
	* options.c: Ditto.
	

Index: openmp.c
===================================================================
--- openmp.c	(Revision 159760)
+++ openmp.c	(Arbeitskopie)
@@ -27,7 +27,6 @@
 #include "parse.h"
 #include "pointer-set.h"
 #include "target.h"
-#include "toplev.h"
 
 /* Match an end of OpenMP directive.  End of OpenMP directive is optional
    whitespace, followed by '\n' or comment '!'.  */
Index: trans-expr.c
===================================================================
--- trans-expr.c	(Revision 159760)
+++ trans-expr.c	(Arbeitskopie)
@@ -26,7 +26,7 @@
 #include "system.h"
 #include "coretypes.h"
 #include "tree.h"
-#include "toplev.h"
+#include "toplev.h"	/* For fatal_error.  */
 #include "langhooks.h"
 #include "flags.h"
 #include "gfortran.h"
Index: trans-array.c
===================================================================
--- trans-array.c	(Revision 159760)
+++ trans-array.c	(Arbeitskopie)
@@ -80,7 +80,7 @@
 #include "system.h"
 #include "coretypes.h"
 #include "tree.h"
-#include "toplev.h"
+#include "toplev.h"	/* For internal_error/fatal_error.  */
 #include "flags.h"
 #include "gfortran.h"
 #include "constructor.h"
Index: dump-parse-tree.c
===================================================================
--- dump-parse-tree.c	(Revision 159760)
+++ dump-parse-tree.c	(Arbeitskopie)
@@ -32,6 +32,7 @@
    TODO: Dump DATA.  */
 
 #include "config.h"
+#include "system.h"
 #include "gfortran.h"
 #include "constructor.h"
 
Index: trans-common.c
===================================================================
--- trans-common.c	(Revision 159760)
+++ trans-common.c	(Arbeitskopie)
@@ -98,7 +98,7 @@
 #include "coretypes.h"
 #include "target.h"
 #include "tree.h"
-#include "toplev.h"
+#include "toplev.h"	/* For exact_log2.  */
 #include "tm.h"		/* For rtl.h.  */
 #include "rtl.h"	/* For decl_default_tls_model.  */
 #include "gfortran.h"
Index: trans-openmp.c
===================================================================
--- trans-openmp.c	(Revision 159760)
+++ trans-openmp.c	(Arbeitskopie)
@@ -25,7 +25,7 @@
 #include "coretypes.h"
 #include "tree.h"
 #include "gimple.h"	/* For create_tmp_var_raw.  */
-#include "toplev.h"
+#include "toplev.h"	/* For internal_error.  */
 #include "gfortran.h"
 #include "trans.h"
 #include "trans-stmt.h"
Index: gfortran.h
===================================================================
--- gfortran.h	(Revision 159760)
+++ gfortran.h	(Arbeitskopie)
@@ -34,7 +34,6 @@
 #include "libgfortran.h"
 
 
-#include "system.h"
 #include "intl.h"
 #include "coretypes.h"
 #include "input.h"
Index: constructor.h
===================================================================
--- constructor.h	(Revision 159760)
+++ constructor.h	(Arbeitskopie)
@@ -21,10 +21,6 @@
 #ifndef GFC_CONSTRUCTOR_H
 #define GFC_CONSTRUCTOR_H
 
-#include "gfortran.h"
-#include "splay-tree.h"
-
-
 /* Get a new constructor structure.  */
 gfc_constructor *gfc_constructor_get (void);
 
Index: data.c
===================================================================
--- data.c	(Revision 159760)
+++ data.c	(Arbeitskopie)
@@ -34,6 +34,7 @@
    trans-array.c.  */
 
 #include "config.h"
+#include "system.h"
 #include "gfortran.h"
 #include "data.h"
 #include "constructor.h"
Index: trans-const.c
===================================================================
--- trans-const.c	(Revision 159760)
+++ trans-const.c	(Arbeitskopie)
@@ -26,7 +26,7 @@
 #include "coretypes.h"
 #include "tree.h"
 #include "realmpfr.h"
-#include "toplev.h"
+#include "toplev.h"	/* Fort fatal_error.  */
 #include "double-int.h"
 #include "gfortran.h"
 #include "trans.h"
Index: trans-stmt.c
===================================================================
--- trans-stmt.c	(Revision 159760)
+++ trans-stmt.c	(Arbeitskopie)
@@ -25,7 +25,6 @@
 #include "system.h"
 #include "coretypes.h"
 #include "tree.h"
-#include "toplev.h"
 #include "gfortran.h"
 #include "flags.h"
 #include "trans.h"
Index: trans.c
===================================================================
--- trans.c	(Revision 159760)
+++ trans.c	(Arbeitskopie)
@@ -25,7 +25,7 @@
 #include "tree.h"
 #include "gimple.h"	/* For create_tmp_var_raw.  */
 #include "tree-iterator.h"
-#include "toplev.h"
+#include "toplev.h"	/* For internal_error.  */
 #include "defaults.h"
 #include "flags.h"
 #include "gfortran.h"
Index: trans-types.c
===================================================================
--- trans-types.c	(Revision 159760)
+++ trans-types.c	(Arbeitskopie)
@@ -30,7 +30,7 @@
 #include "langhooks.h"	/* For iso-c-bindings.def.  */
 #include "target.h"
 #include "ggc.h"
-#include "toplev.h"
+#include "toplev.h"	/* For rest_of_decl_compilation/fatal_error.  */
 #include "gfortran.h"
 #include "trans.h"
 #include "trans-types.h"
Index: scanner.c
===================================================================
--- scanner.c	(Revision 159760)
+++ scanner.c	(Arbeitskopie)
@@ -44,7 +44,7 @@
 #include "config.h"
 #include "system.h"
 #include "gfortran.h"
-#include "toplev.h"
+#include "toplev.h"	/* For set_src_pwd.  */
 #include "debug.h"
 #include "flags.h"
 #include "cpp.h"
Index: bbt.c
===================================================================
--- bbt.c	(Revision 159760)
+++ bbt.c	(Arbeitskopie)
@@ -37,6 +37,7 @@
    July 1997 Doctor Dobb's Journal, "Treaps in Java".  */
 
 #include "config.h"
+#include "system.h"
 #include "gfortran.h"
 
 typedef struct gfc_treap
Index: trans-io.c
===================================================================
--- trans-io.c	(Revision 159760)
+++ trans-io.c	(Arbeitskopie)
@@ -25,7 +25,7 @@
 #include "coretypes.h"
 #include "tree.h"
 #include "ggc.h"
-#include "toplev.h"
+#include "toplev.h"	/* For internal_error.  */
 #include "gfortran.h"
 #include "trans.h"
 #include "trans-stmt.h"
Index: trans-decl.c
===================================================================
--- trans-decl.c	(Revision 159760)
+++ trans-decl.c	(Arbeitskopie)
@@ -28,7 +28,7 @@
 #include "tree-dump.h"
 #include "gimple.h"	/* For create_tmp_var_raw.  */
 #include "ggc.h"
-#include "toplev.h"
+#include "toplev.h"	/* For announce_function/internal_error.  */
 #include "tm.h"		/* For rtl.h.  */
 #include "rtl.h"	/* For decl_default_tls_model.  */
 #include "target.h"
Index: target-memory.h
===================================================================
--- target-memory.h	(Revision 159760)
+++ target-memory.h	(Arbeitskopie)
@@ -22,8 +22,6 @@
 #ifndef GFC_TARGET_MEMORY_H
 #define GFC_TARGET_MEMORY_H
 
-#include "gfortran.h"
-
 /* Convert a BOZ to REAL or COMPLEX.  */
 bool gfc_convert_boz (gfc_expr *, gfc_typespec *);
 
Index: match.h
===================================================================
--- match.h	(Revision 159760)
+++ match.h	(Arbeitskopie)
@@ -23,8 +23,6 @@
 #ifndef GFC_MATCH_H
 #define GFC_MATCH_H
 
-#include "gfortran.h"
-
 /* gfc_new_block points to the symbol of a newly matched block.  */
 extern gfc_symbol *gfc_new_block;
 
Index: arith.h
===================================================================
--- arith.h	(Revision 159760)
+++ arith.h	(Arbeitskopie)
@@ -22,8 +22,6 @@
 #ifndef GFC_ARITH_H
 #define GFC_ARITH_H
 
-#include "gfortran.h"
-
 /* MPFR also does not have the conversion of a mpfr_t to a mpz_t, so declare
    a function for this as well.  */
 
Index: dependency.c
===================================================================
--- dependency.c	(Revision 159760)
+++ dependency.c	(Arbeitskopie)
@@ -25,6 +25,7 @@
    if dependencies.  Ideally these would probably be merged.  */
    
 #include "config.h"
+#include "system.h"
 #include "gfortran.h"
 #include "dependency.h"
 #include "constructor.h"
Index: parse.h
===================================================================
--- parse.h	(Revision 159760)
+++ parse.h	(Arbeitskopie)
@@ -23,8 +23,6 @@
 #ifndef GFC_PARSE_H
 #define GFC_PARSE_H
 
-#include "gfortran.h"
-
 /* Enum for what the compiler is currently doing.  */
 typedef enum
 {
Index: convert.c
===================================================================
--- convert.c	(Revision 159760)
+++ convert.c	(Arbeitskopie)
@@ -40,7 +40,7 @@
 #include "tree.h"
 #include "flags.h"
 #include "convert.h"
-#include "toplev.h"
+#include "toplev.h"	/* For error().  */
 #include "gfortran.h"
 #include "trans.h"
 
Index: primary.c
===================================================================
--- primary.c	(Revision 159760)
+++ primary.c	(Arbeitskopie)
@@ -26,7 +26,6 @@
 #include "arith.h"
 #include "match.h"
 #include "parse.h"
-#include "toplev.h"
 #include "constructor.h"
 
 /* Matches a kind-parameter expression, which is either a named
Index: trans-intrinsic.c
===================================================================
--- trans-intrinsic.c	(Revision 159760)
+++ trans-intrinsic.c	(Arbeitskopie)
@@ -28,7 +28,7 @@
 #include "tm.h"		/* For UNITS_PER_WORD.  */
 #include "tree.h"
 #include "ggc.h"
-#include "toplev.h"
+#include "toplev.h"	/* For rest_of_decl_compilation/internal_error.  */
 #include "flags.h"
 #include "gfortran.h"
 #include "arith.h"
Index: options.c
===================================================================
--- options.c	(Revision 159760)
+++ options.c	(Arbeitskopie)
@@ -33,7 +33,7 @@
 #include "gfortran.h"
 #include "target.h"
 #include "cpp.h"
-#include "toplev.h"
+#include "toplev.h"	/* For sorry.  */
 #include "tm.h"
 
 gfc_option_t gfc_option;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]