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 to remove fixes that just wrap with #ifndef


Fixincludes fixes that just add #ifndef about some definition that may
be in more than one header are unnecessary since duplicate macro
definitions, even with different values, are allowed in system headers
and if some definition is actually wrong there's just as much case for
fixing it with or without the #ifndef.  This patch removes such fixes
which just add #ifndef.

(With the #ifndef, you get the definition from the first header included.  
Without, you get the definition from the second header included.  There's 
no clear advantage one way or another; if there is a significant 
difference between the definitions, that is its own header bug which may 
merit its own fix.)

Bootstrapped with no regressions on hppa2.0w-hp-hpux11.11.  OK to
commit (with corresponding testsuite updates)?

-- 
Joseph S. Myers               http://www.srcf.ucam.org/~jsm28/gcc/
    jsm@polyomino.org.uk (personal mail)
    joseph@codesourcery.com (CodeSourcery mail)
    jsm28@gcc.gnu.org (Bugzilla assignments and CCs)

2004-11-13  Joseph S. Myers  <joseph@codesourcery.com>

	* inclhack.def (hpux_maxint, limits_ifndefs, math_huge_val_ifndef,
	svr4__p, undefine_null): Remove.
	* fixincl.x: Regenerate.

diff -rupN fixincludes.orig/inclhack.def fixincludes/inclhack.def
--- fixincludes.orig/inclhack.def	2004-11-12 20:37:09.000000000 +0000
+++ fixincludes/inclhack.def	2004-11-12 20:36:58.000000000 +0000
@@ -1481,26 +1481,6 @@ fix = {
 
 
 /*
- *  HPUX 10.x sys/param.h defines MAXINT which clashes with values.h
- */
-fix = {
-    hackname  = hpux_maxint;
-    files     = sys/param.h;
-    files     = values.h;
-    select    = "^#[ \t]*define[ \t]+MAXINT[ \t]";
-    bypass    = "^#[ \t]*ifndef[ \t]+MAXINT";
-    test =
-    "-n \"`egrep '#[ \t]*define[ \t]+MAXINT[ \t]' sys/param.h`\"";
-
-    c_fix     = format;
-    c_fix_arg = "#ifndef MAXINT\n%0\n#endif";
-    c_fix_arg = "^#[ \t]*define[ \t]+MAXINT[ \t].*";
-
-    test_text = '#define MAXINT 0x7FFFFFFF';
-};
-
-
-/*
  *  Fix hpux10.20 <sys/time.h> to avoid invalid forward decl
  */
 fix = {
@@ -1863,34 +1843,6 @@ fix = {
 };
 
 
-/*
- *  In limits.h, put #ifndefs around things that are supposed to be defined
- *  in float.h to avoid redefinition errors if float.h is included first.
- *  On HP/UX this patch does not work, because on HP/UX limits.h uses
- *  multi line comments and the inserted #endif winds up inside the
- *  comment.  Fortunately, HP/UX already uses #ifndefs in limits.h; if
- *  we find a #ifndef FLT_MIN we assume that all the required #ifndefs
- *  are there, and we do not add them ourselves.
- *
- *  QNX Software Systems also guards the defines, but doesn't define
- *  FLT_MIN.  Therefore, bypass the fix for *either* guarded FLT_MIN
- *  or guarded FLT_MAX.
- */
-fix = {
-    hackname = limits_ifndefs;
-    files  = "sys/limits.h";
-    files  = "limits.h";
-    select = "^[ \t]*#[ \t]*define[ \t]+"
-             "((FLT|DBL)_(MIN|MAX|DIG))[ \t].*";
-    bypass = "ifndef[ \t]+FLT_(MIN|MAX)";
-
-    c_fix     = format;
-    c_fix_arg = "#ifndef %1\n%0\n#endif";
-    /* Second arg is select expression */
-    test_text = " #\tdefine\tDBL_DIG \t 0  /* somthin' */";
-};
-
-
 /* The /usr/include/sys/ucontext.h on ia64-*linux-gnu systems defines
  * an _SC_GR0_OFFSET macro using an idiom that isn't a compile time
  * constant on recent versions of g++.
@@ -2060,23 +2012,6 @@ fix = {
 
 
 /*
- * In any case, put #ifndef .. #endif around #define HUGE_VAL in math.h.
- */
-fix = {
-    hackname = math_huge_val_ifndef;
-    files    = math.h;
-    files    = math/math.h;
-    select   = "define[ \t]+HUGE_VAL";
-
-    c_fix     = format;
-    c_fix_arg = "#ifndef HUGE_VAL\n%0\n#endif";
-    c_fix_arg = "^[ \t]*#[ \t]*define[ \t]+HUGE_VAL[ \t].*";
-
-    test_text = "# define\tHUGE_VAL 3.4e+40";
-};
-
-
-/*
  *  nested comment
  */
 fix = {
@@ -3037,23 +2972,6 @@ fix = {
 
 
 /*
- *  Solaris math.h and floatingpoint.h define __P without protection,
- *  which conflicts with the fixproto definition.  The fixproto
- *  definition and the Solaris definition are used the same way.
- */
-fix = {
-    hackname = svr4__p;
-    files    = math.h;
-    files    = floatingpoint.h;
-    select   = "^#define[ \t]+__P.*";
-    c_fix     = format;
-    c_fix_arg = "#ifndef __P\n%0\n#endif";
-
-    test_text = "#define __P(a) a";
-};
-
-
-/*
  *  Disable apparent native compiler optimization cruft in SVR4.2 <string.h>
  *  that is visible to any ANSI compiler using this include.  Simply
  *  delete the lines that #define some string functions to internal forms.
@@ -3908,25 +3826,6 @@ fix = {
 
 
 /*
- *  Fix multiple defines for NULL.  Sometimes, we stumble into \r\n
- *  terminated lines, so accommodate these.  Test both ways.
- *  Don't bother to reproduce the \r\n termination, as GCC has to
- *  recognize \n termination anyway.
- */
-fix = {
-    hackname  = undefine_null;
-    select    = "^#[ \t]*define[ \t]+NULL[ \t]";
-    bypass    = "#[ \t]*(ifn|un)def[ \t]+NULL($|[ \t\r])";
-
-    c_fix     = format;
-    c_fix_arg = "#ifndef NULL\n#define NULL%1\n#endif\n";
-    c_fix_arg = "^#[ \t]*define[ \t]+NULL([^\r\n]+)[\r]*\n";
-
-    test_text = "#define NULL 0UL\r\n"
-                "#define NULL\t((void*)0)\n";
-};
-
-/*
  * On Cray Unicos/Mk some standard headers use the C99 keyword "restrict"
  * which must be replaced by __restrict__ for GCC.
  */


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