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]

Re: cpplib: Dump __GXX_WEAK__ and __STDC__ with -dM


Kaveh R. Ghazi writes:

> I agree they should be connected.  However I prefer the former option.
> I.e. tie the tranformations to STDC_0_IN_SYSTEM_HEADERS, not to
> solaris2.
> 
> It should be the case that STDC_0_IN_SYSTEM_HEADERS is valid for any
> svr4, in which case other variants may decide to turn it on.  In that
> case it would be good not to have to remember to also patch
> inclhack.def.
> 
> Rainer, can you please try wrapping those fixes in #ifdef
> STDC_0_IN_SYSTEM_HEADERS instead of using the "mach" and see if that
> also works?

no, this doesn't work since #ifdef's in inclhack.def are only evaluated
when autogen is run to generate fixincl.x, and while autogen understands
about -D, no -D flags are currently passed to it in fixinc/genfixes or
fixinc/Makefile.  This approach isn't viable anyway, since we cannot rely
on users having autogen installed, so the generated files must be constant
across platforms.

Btw, this means that everything currently wrapped in e.g. #ifdef SVR4,
SONY, SVR5 is missing from fixincl.x either, and thus not applied when
fixincludes is run ;-(

Thus the test for STDC_0_IN_SYSTEM_HEADERS must be deferred to fixincl
compile time.  The following patch worked for me.  I needed to include
config.h (tconfig.h?) in fixlib.h so the target defines are visible when
fixtests.c is compiled.

While testing this fix, I noticed another problem: fixincl.c doesn't
currently compile with -DDEBUG:

fixinc/fixincl.c: In function `fix_applies':
fixinc/fixincl.c:1167: `z_failed' undeclared (first use in this function)
fixinc/fixincl.c:1167: (Each undeclared identifier is reported only once
fixinc/fixincl.c:1167: for each function it appears in.)

	Rainer

-----------------------------------------------------------------------------
Rainer Orth, Faculty of Technology, Bielefeld University

Email: ro@TechFak.Uni-Bielefeld.DE


Mon Mar  5 19:08:12 2001  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>

	* fixinc/inclhack.def (strict_ansi_not, strict_ansi_not_ctd,
	strict_ansi_only): Don't run if stdc_0_in_system_headers.
	* fixinc/fixincl.c: Regenerate.
	* fixinc/fixtests.c (stdc_0_in_system_headers_test): New function.
	(FIX_TEST_TABLE): Declare it.
	* fixinc/fixlib.h: Include config.h.

Index: fixlib.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/fixinc/fixlib.h,v
retrieving revision 1.20
diff -u -p -r1.20 fixlib.h
--- fixlib.h	2000/12/13 20:07:46	1.20
+++ fixlib.h	2001/03/06 18:28:03
@@ -27,6 +27,7 @@ Boston, MA 02111-1307, USA.  */
 
 #include "auto-host.h"
 #include "gansidecl.h"
+#include "config.h"
 #include "system.h"
 
 #include "gnu-regex.h"
Index: fixtests.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/fixinc/fixtests.c,v
retrieving revision 1.24
diff -u -p -r1.24 fixtests.c
--- fixtests.c	2000/12/13 20:07:46	1.24
+++ fixtests.c	2001/03/06 18:28:03
@@ -55,7 +55,8 @@ typedef struct {
 } test_entry_t;
 
 #define FIX_TEST_TABLE \
-  _FT_( "machine_name",     machine_name_test )
+  _FT_( "machine_name",     machine_name_test )	\
+  _FT_( "stdc_0_in_system_headers",	stdc_0_in_system_headers_test )
 
 #define TEST_FOR_FIX_PROC_HEAD( test )          \
 static apply_fix_p_t test PARAMS(( tCC* file, tCC* text ));  \
@@ -112,6 +113,16 @@ TEST_FOR_FIX_PROC_HEAD( machine_name_tes
       /* Otherwise, keep looking... */
     }
   return SKIP_FIX;
+#endif
+}
+
+
+TEST_FOR_FIX_PROC_HEAD( stdc_0_in_system_headers_test )
+{
+#ifdef STDC_0_IN_SYSTEM_HEADERS
+  return SKIP_FIX;
+#else
+  return APPLY_FIX;
 #endif
 }
 
Index: inclhack.def
===================================================================
RCS file: /cvs/gcc/egcs/gcc/fixinc/inclhack.def,v
retrieving revision 1.101.2.1
diff -u -p -r1.101.2.1 inclhack.def
--- inclhack.def	2001/02/21 20:08:17	1.101.2.1
+++ inclhack.def	2001/03/06 18:28:05
@@ -1932,6 +1932,7 @@ fix = {
                "|__STDC__[ \t]*!=[ \t]*1"
                "|__STDC__[ \t]*-[ \t]*0[ \t]*==[ \t]*0"
                ")(.*)";
+    c_test   = stdc_0_in_system_headers;
 
     c_fix     = format;
     c_fix_arg = "%1 !defined(__STRICT_ANSI__)%3";
@@ -1958,6 +1959,7 @@ fix = {
     select   = "^([ \t]*[|&][|&][ \t(]*)"
                "(__STDC__[ \t]*-[ \t]*0[ \t]*==[ \t]*0"
                ")(.*)";
+    c_test   = stdc_0_in_system_headers;
 
     c_fix     = format;
     c_fix_arg = "%1 !defined(__STRICT_ANSI__)%3";
@@ -1978,6 +1980,7 @@ fix = {
                "|__STDC__[ \t]*-[ \t]*0[ \t]*==[ \t]*1"
                "|__STDC__[ \t]*-[ \t]*0[ \t]*!=[ \t]*0"
                ")(.*)";
+    c_test   = stdc_0_in_system_headers;
 
     c_fix     = format;
     c_fix_arg = "%1 defined(__STRICT_ANSI__)%3";


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