This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [Patch, Fortran] Minor include-file cleanup
- From: Tobias Burnus <burnus at net-b dot de>
- To: gfortran <fortran at gcc dot gnu dot org>, gcc patches <gcc-patches at gcc dot gnu dot org>
- Cc: Steven Bosscher <stevenb dot gcc at gmail dot com>
- Date: Sun, 23 May 2010 18:58:19 +0200
- Subject: Re: [Patch, Fortran] Minor include-file cleanup
- References: <4BF94A07.4080305@net-b.de>
Tobias Burnus wrote:
> This patch does a minor cleanup:
>
I just saw that
e) target.h can be removed from openmp.c and trans-common.c
(It is unused)
Updated patch attached. Build on x86-64-linux.
OK for the trunk?
Tobias
> 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?
>
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 and target.h.
* trans-stmt.c: Ditto not include toplev.h.
* primary.c: Ditto.
* trans-common.c: Tell why toplev.h is needed. And
do not include target.h.
* trans-expr.c: Tell why toplev.h is needed.
* trans-array.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 159762)
+++ openmp.c (Arbeitskopie)
@@ -26,8 +26,6 @@
#include "match.h"
#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 159762)
+++ 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 159762)
+++ 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 159762)
+++ 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 159762)
+++ trans-common.c (Arbeitskopie)
@@ -96,9 +96,8 @@
#include "config.h"
#include "system.h"
#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 159762)
+++ 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 159762)
+++ 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 159762)
+++ 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 159762)
+++ 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 159762)
+++ 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 159762)
+++ 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 159762)
+++ 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 159762)
+++ 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 159762)
+++ 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 159762)
+++ 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 159762)
+++ 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 159762)
+++ 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 159762)
+++ 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 159762)
+++ 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 159762)
+++ 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 159762)
+++ 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 159762)
+++ 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 159762)
+++ 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 159762)
+++ 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 159762)
+++ 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 159762)
+++ 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;