diff mbox

options.h and comments on a couple of tm.h #include's

Message ID 55A68B1B.7000201@redhat.com
State New
Headers show

Commit Message

Andrew MacLeod July 15, 2015, 4:32 p.m. UTC
I think this is the last patch before I start include reductions and 
cleanups.

options.h is generated with the following snippet:

/* Anything that includes tm.h, does not necessarily need this.  */"
#if !defined(GCC_TM_H)
#include "input.h" /* for location_t */
<...>
// bunch of prototypes which use location_t
<...>
#endif

This is primarily so that the generator files can compile which don't 
include input.h, and thus have no location_t defined.
options.h is usually included by tm.h, but some front end files include 
just option.h, and the inclusion of input.h is so that they don't have 
to I guess.

input.h is now included by coretypes.h, so any of these files that care 
about the prototypes  already have input.h.  It seems to make more sense 
to simply check if input.h has been included instead of a weird 
contortion on tm.h, which is really unrelated in many ways. (I'm simply 
checking if UNKNOWN_LOCATION is defined)   In fact, the current approach 
introduces a latent ordering issue in a number of front end files... 
they include options.h because they dont need tm.h, but then include 
tm.h indirectly through target.h..  if the include order is changed such 
that target.h was included *before* options.h (or instead of), some 
files fail to compile because they no longer see these prototypes.   
this just cleans that crud up.

The other 4 files in the patch include tm.h on a line with a multi-line 
comment following it.  The comment is suppose to reflect what macros the 
include is for, but at least some of these are out of date.. no one 
updates them. The information they convey is easily determined in an up 
to date way by simply removing the include from the list and compiling 
the .o.  Plus many other front end files dont bother with this, so its 
inconsistent.  And my real motivation is because it plays havoc with my 
automatic include maniupulations :-)    So i propose just removing the 
comments.

I didnt bother trying to merge options.h and tm.h in various files, 
mostly because for the include reduction, Im going to flatten option.h 
out of tm.h and tm.h/hard-reg-set.h  out of target.h.  I wont bother 
submitting that to mainline since its going to affect all the same files 
I'll be checking in later.  When the reduction is done, I'll look at who 
actually needed options.h, tm.h, target.h and maybe they'll probably get 
mashed back to the way they are now(or maybe they wont... :-)  it'll 
depend on the usage patterns.  In any case, i dont need to pollute trunk 
until I know for sure.

This bootstraps on x86_64-unknown-linux-gnu with no new regressions.  ok 
for trunk?

Andrew

Comments

Jeff Law July 15, 2015, 4:51 p.m. UTC | #1
On 07/15/2015 10:32 AM, Andrew MacLeod wrote:
> I think this is the last patch before I start include reductions and
> cleanups.
>
> options.h is generated with the following snippet:
>
> /* Anything that includes tm.h, does not necessarily need this.  */"
> #if !defined(GCC_TM_H)
> #include "input.h" /* for location_t */
> <...>
> // bunch of prototypes which use location_t
> <...>
> #endif
>
> This is primarily so that the generator files can compile which don't
> include input.h, and thus have no location_t defined.
> options.h is usually included by tm.h, but some front end files include
> just option.h, and the inclusion of input.h is so that they don't have
> to I guess.
>
> input.h is now included by coretypes.h, so any of these files that care
> about the prototypes  already have input.h.  It seems to make more sense
> to simply check if input.h has been included instead of a weird
> contortion on tm.h, which is really unrelated in many ways. (I'm simply
> checking if UNKNOWN_LOCATION is defined)   In fact, the current approach
> introduces a latent ordering issue in a number of front end files...
> they include options.h because they dont need tm.h, but then include
> tm.h indirectly through target.h..  if the include order is changed such
> that target.h was included *before* options.h (or instead of), some
> files fail to compile because they no longer see these prototypes. this
> just cleans that crud up.
>
> The other 4 files in the patch include tm.h on a line with a multi-line
> comment following it.  The comment is suppose to reflect what macros the
> include is for, but at least some of these are out of date.. no one
> updates them. The information they convey is easily determined in an up
> to date way by simply removing the include from the list and compiling
> the .o.  Plus many other front end files dont bother with this, so its
> inconsistent.  And my real motivation is because it plays havoc with my
> automatic include maniupulations :-)    So i propose just removing the
> comments.
>
> I didnt bother trying to merge options.h and tm.h in various files,
> mostly because for the include reduction, Im going to flatten option.h
> out of tm.h and tm.h/hard-reg-set.h  out of target.h.  I wont bother
> submitting that to mainline since its going to affect all the same files
> I'll be checking in later.  When the reduction is done, I'll look at who
> actually needed options.h, tm.h, target.h and maybe they'll probably get
> mashed back to the way they are now(or maybe they wont... :-)  it'll
> depend on the usage patterns.  In any case, i dont need to pollute trunk
> until I know for sure.
>
> This bootstraps on x86_64-unknown-linux-gnu with no new regressions.  ok
> for trunk?
OK.
jeff
diff mbox

Patch


	* opth-gen.awk: Check for UNKNOWN_LOCATION rather than GCC_TM_H, don't
	include input.h.
	* opts.c: Remove multiline #include comment.
	* java/expr.c: Remove multiline #include comment.
	* fortran/trans-types.c: Remove multiline #include comment.
	* c-family/c-opts.c: Remove multiline #include comment.



Index: opth-gen.awk
===================================================================
*** opth-gen.awk	(revision 225789)
--- opth-gen.awk	(working copy)
*************** print "";
*** 308,316 ****
  print "/* Hash optimization from a structure.  */";
  print "extern hashval_t cl_optimization_hash (const struct cl_optimization *);";
  print "";
! print "/* Anything that includes tm.h, does not necessarily need this.  */"
! print "#if !defined(GCC_TM_H)"
! print "#include \"input.h\" /* for location_t */"
  print "bool                                                                  "
  print "common_handle_option_auto (struct gcc_options *opts,                  "
  print "                           struct gcc_options *opts_set,              "
--- 308,315 ----
  print "/* Hash optimization from a structure.  */";
  print "extern hashval_t cl_optimization_hash (const struct cl_optimization *);";
  print "";
! print "/* Generator files may not have access to location_t, and don't need these.  */"
! print "#if defined(UNKNOWN_LOCATION)"
  print "bool                                                                  "
  print "common_handle_option_auto (struct gcc_options *opts,                  "
  print "                           struct gcc_options *opts_set,              "
Index: java/expr.c
===================================================================
*** java/expr.c	(revision 225789)
--- java/expr.c	(working copy)
*************** The Free Software Foundation is independ
*** 26,37 ****
  #include "config.h"
  #include "system.h"
  #include "coretypes.h"
! #include "tm.h"			/* For INT_TYPE_SIZE,
! 				   TARGET_VTABLE_USES_DESCRIPTORS,
! 				   BITS_PER_UNIT,
! 				   MODIFY_JNI_METHOD_CALL and
! 				   PARM_BOUNDARY.  */
! 				   
  #include "alias.h"
  #include "tree.h"
  #include "fold-const.h"
--- 26,32 ----
  #include "config.h"
  #include "system.h"
  #include "coretypes.h"
! #include "tm.h"
  #include "alias.h"
  #include "tree.h"
  #include "fold-const.h"
Index: fortran/trans-types.c
===================================================================
*** fortran/trans-types.c	(revision 225789)
--- fortran/trans-types.c	(working copy)
*************** along with GCC; see the file COPYING3.
*** 24,38 ****
  #include "config.h"
  #include "system.h"
  #include "coretypes.h"
! #include "tm.h"		/* For INTMAX_TYPE, INT8_TYPE, INT16_TYPE, INT32_TYPE,
! 			   INT64_TYPE, INT_LEAST8_TYPE, INT_LEAST16_TYPE,
! 			   INT_LEAST32_TYPE, INT_LEAST64_TYPE, INT_FAST8_TYPE,
! 			   INT_FAST16_TYPE, INT_FAST32_TYPE, INT_FAST64_TYPE,
! 			   BOOL_TYPE_SIZE, BITS_PER_UNIT, POINTER_SIZE,
! 			   INT_TYPE_SIZE, CHAR_TYPE_SIZE, SHORT_TYPE_SIZE,
! 			   LONG_TYPE_SIZE, LONG_LONG_TYPE_SIZE,
! 			   FLOAT_TYPE_SIZE, DOUBLE_TYPE_SIZE and
! 			   LONG_DOUBLE_TYPE_SIZE.  */
  #include "alias.h"
  #include "tree.h"
  #include "fold-const.h"
--- 24,30 ----
  #include "config.h"
  #include "system.h"
  #include "coretypes.h"
! #include "tm.h"
  #include "alias.h"
  #include "tree.h"
  #include "fold-const.h"
Index: c-family/c-opts.c
===================================================================
*** c-family/c-opts.c	(revision 225789)
--- c-family/c-opts.c	(working copy)
*************** along with GCC; see the file COPYING3.
*** 21,27 ****
  #include "config.h"
  #include "system.h"
  #include "coretypes.h"
! #include "options.h"
  #include "alias.h"
  #include "tree.h"
  #include "c-common.h"
--- 21,27 ----
  #include "config.h"
  #include "system.h"
  #include "coretypes.h"
! #include "tm.h"
  #include "alias.h"
  #include "tree.h"
  #include "c-common.h"
*************** along with GCC; see the file COPYING3.
*** 39,49 ****
  #include "plugin.h"		/* For PLUGIN_INCLUDE_FILE event.  */
  #include "mkdeps.h"
  #include "c-target.h"
- #include "tm.h"			/* For BYTES_BIG_ENDIAN,
- 				   DOLLARS_IN_IDENTIFIERS,
- 				   STDC_0_IN_SYSTEM_HEADERS,
- 				   TARGET_FLT_EVAL_METHOD_NON_DEFAULT and
- 				   TARGET_OPTF.  */
  #include "tm_p.h"		/* For C_COMMON_OVERRIDE_OPTIONS.  */
  #include "dumpfile.h"
  
--- 39,44 ----
Index: opts.c
===================================================================
*** opts.c	(revision 225789)
--- opts.c	(working copy)
*************** along with GCC; see the file COPYING3.
*** 23,32 ****
  #include "intl.h"
  #include "coretypes.h"
  #include "opts.h"
! #include "options.h"
! #include "tm.h" /* For STACK_CHECK_BUILTIN,
! 		   STACK_CHECK_STATIC_BUILTIN, DEFAULT_GDB_EXTENSIONS,
! 		   DWARF2_DEBUGGING_INFO and DBX_DEBUGGING_INFO.  */
  #include "flags.h"
  #include "params.h"
  #include "diagnostic.h"
--- 23,29 ----
  #include "intl.h"
  #include "coretypes.h"
  #include "opts.h"
! #include "tm.h"
  #include "flags.h"
  #include "params.h"
  #include "diagnostic.h"