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]

Re: Protoize does not build with gcc 4.x


Andreas Krebbel <krebbel1@de.ibm.com> writes:
> Your patch "Using .opt files for target options"
> http://gcc.gnu.org/ml/gcc-patches/2005-03/msg01297.html
>
> makes options.h to be included by tm.h by adding it to tm_include_list
> in gcc/configure.ac. tm.h is included by protoize.c. That leads to a name 
> clash between the "version_flag" and "quiet_flag" symbols defined as 
> extern in options.h and defined static in protoize.c.

OK, so my first question was: why is protoize including tm.h in the
first place?  The answer seems to be (a) to pull in the definition
of GET_ENVIRONMENT and (b) so that the target files can override
STANDARD_EXEC_PREFIX (as config/netbsd.h does).  Both reasons seem
a bit dubious to me though.  Especially (b). ;)

Wrt (a), I'm not sure what purpose GET_ENVIRONMENT serves.
The only definition in the CVS tree is the one provided by
gcc/defaults.h.  Does some weird OS define GET_ENVIRONMENT and
not provide getenv()?  (Despite it being a standard function?)
Is this some left-over from the pre-C89 days?  I notice we
already have unguarded uses of getenv() in cp/repo.c, so I
assume we'd have noticed by now if using getenv() was a problem.

Besides, since this is a host macro, I would have thought system.h
would be a more natural place for it.

Wrt (b), why is config/netbsd.h overriding STANDARD_EXEC_PREFIX?
Why doesn't netbsd use some configure or Makefile goo instead?
The current set-up seems wrong for two reasons: (1) config/netbsd.h
is a target file, whereas STANDARD_EXEC_PREFIX (unlike MD_EXEC_PREFIX)
is a host macro and (2) the usual definition of "$(libdir)/gcc"
includes the configured prefix, which the config/netbsd.h definition
of "/usr/libexec" replaces with a hard-coded reference to /usr.

Still, it looked like getting rid of the tm.h include might be
a bit controversial, so I went for the simpler fix of making the
protoize.c flags "extern".  An alternative would have been to
rename the variables, and if anyone has any strong preference
for that approach, I'll be happy to submit a revised patch.

Tested using test-protoize-simple.  OK to install?

Richard


	* protoize.c (version_flag, quiet_flag, nochange_flag, nosave_flag)
	(keep_flag, local_flag, global_flag, cplusplus_flag): Make extern.

Index: protoize.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/protoize.c,v
retrieving revision 1.92
diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.92 protoize.c
--- protoize.c	3 Apr 2005 10:27:46 -0000	1.92
+++ protoize.c	30 Apr 2005 08:10:55 -0000
@@ -368,20 +368,20 @@ static int errors = 0;
    something other than gcc.  */
 static const char *compiler_file_name = "gcc";
 
-static int version_flag = 0;		/* Print our version number.  */
-static int quiet_flag = 0;		/* Don't print messages normally.  */
-static int nochange_flag = 0;		/* Don't convert, just say what files
-					   we would have converted.  */
-static int nosave_flag = 0;		/* Don't save the old version.  */
-static int keep_flag = 0;		/* Don't delete the .X files.  */
+int version_flag = 0;		/* Print our version number.  */
+int quiet_flag = 0;		/* Don't print messages normally.  */
+int nochange_flag = 0;		/* Don't convert, just say what files
+				   we would have converted.  */
+int nosave_flag = 0;		/* Don't save the old version.  */
+int keep_flag = 0;		/* Don't delete the .X files.  */
 static const char ** compile_params = 0;	/* Option string for gcc.  */
 #ifdef UNPROTOIZE
 static const char *indent_string = "     ";	/* Indentation for newly
 						   inserted parm decls.  */
 #else /* !defined (UNPROTOIZE) */
-static int local_flag = 0;		/* Insert new local decls (when?).  */
-static int global_flag = 0;		/* set by -g option */
-static int cplusplus_flag = 0;		/* Rename converted files to *.C.  */
+int local_flag = 0;		/* Insert new local decls (when?).  */
+int global_flag = 0;		/* set by -g option */
+int cplusplus_flag = 0;		/* Rename converted files to *.C.  */
 static const char *nondefault_syscalls_dir = 0; /* Dir to look for
 						   SYSCALLS.c.X in.  */
 #endif /* !defined (UNPROTOIZE) */


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