This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Maintenance patch for protoize
- To: law at cygnus dot com, egcs-patches at gcc dot gnu dot org
- Subject: Maintenance patch for protoize
- From: Geoff Keating <geoffk at ozemail dot com dot au>
- Date: Mon, 16 Aug 1999 15:46:34 +1000
- CC: brolley at cygnus dot com, bothner at cygnus dot com
Attached. OK to commit?
As far as I can see, the patch only neatens things up, it doesn't
provide any new features (oh, except that 'test-protoize-simple'
passes now).
--
Geoffrey Keating <geoffk@cygnus.com>
===File ~/patches/cygnus/protoize-arg-2.patch===============
Index: egcs/gcc/ChangeLog
0a
Tue May 18 12:06:52 1999 Fred Fish <fnf@cygnus.com>
Geoffrey Keating <geoffk@cygnus.com>
* Makefile.in (PREPROCESSOR_DEFINES): New macro.
(protoize.o): Use PREPROCESSOR_DEFINES and DRIVER_DEFINES.
(unprotoize.o): Ditto.
(test-protoize-simple): Don't define STD_PROTO_DIR.
* protoize.c: Use PARAMS rather than PROTO. Minor whitespace
changes to make 'test-protoize-simple' pass.
(STD_PROTO_DIR): Remove define.
(STANDARD_EXEC_PREFIX): Supply default define.
(standard_exec_prefix): New variable, init to STANDARD_EXEC_PREFIX.
(target_machine): New variable, init to DEFAULT_TARGET_MACHINE.
(target_version): New variable, init to DEFAULT_TARGET_VERSION.
(GET_ENV_PATH_LIST): New macro.
(default_syscalls_dir): No longer initialized to STD_PROTO_DIR.
(do_processing): Initialize default_syscalls_dir using new
macros. Use it to initialize syscalls_absolute_filename.
.
Changed files:
egcs/gcc/ChangeLog
egcs/gcc/Makefile.in
egcs/gcc/cstamp-h.in
egcs/gcc/protoize.c
--- /sloth/disk0/co/egcs-mainline/egcs/gcc/Makefile.in Sat Aug 14 18:32:12 1999
+++ egcs/gcc/Makefile.in Mon Aug 16 15:35:58 1999
@@ -1952,16 +1952,18 @@ CCCP_OBJS = cccp.o cexp.o intl.o prefix.
$(srcdir)/cexp.c: $(srcdir)/cexp.y
cd $(srcdir); $(BISON) -o cexp.c cexp.y
+PREPROCESSOR_DEFINES = \
+ -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
+ -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
+ -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
+ -DCROSS_INCLUDE_DIR=\"$(gcc_tooldir)/sys-include\" \
+ -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\"
# We use $(libsubdir)/$(unlibsubdir) to match the
# -iprefix argument which gcc will pass if GCC_EXEC_PREFIX is used.
cccp.o: cccp.c $(CONFIG_H) intl.h pcp.h version.c config.status system.h \
mbchar.h prefix.h Makefile.in
$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
- -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
- -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
- -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
- -DCROSS_INCLUDE_DIR=\"$(gcc_tooldir)/sys-include\" \
- -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \
+ $(PREPROCESSOR_DEFINES) \
-c `echo $(srcdir)/cccp.c | sed 's,^\./,,'`
LIBCPP_OBJS = cpplib.o cpphash.o cppalloc.o cpperror.o cppexp.o cppfiles.o \
@@ -1991,11 +1993,7 @@ LIBCPP_OBJS = cpplib.o cpphash.o cppallo
cppinit.o: cppinit.c $(CONFIG_H) cpplib.h intl.h system.h \
cpphash.h prefix.h output.h Makefile
$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
- -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
- -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
- -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
- -DCROSS_INCLUDE_DIR=\"$(gcc_tooldir)/sys-include\" \
- -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \
+ $(PREPROCESSOR_DEFINES) \
-c `echo $(srcdir)/cppinit.c | sed 's,^\./,,'`
# Note for the stamp targets, we run the program `true' instead of
@@ -2014,23 +2012,13 @@ PROTO_OBJS = getpwd.o intl.o version.o
protoize.o: protoize.c $(srcdir)/../include/getopt.h $(CONFIG_H) system.h \
Makefile
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
- -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
- -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
- -DCROSS_INCLUDE_DIR=\"$(gcc_tooldir)/sys-include\" \
- -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \
- -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
- -DSTD_PROTO_DIR=\"$(libsubdir)\" \
+ $(DRIVER_DEFINES) $(PREPROCESSOR_DEFINES) \
$(srcdir)/protoize.c
unprotoize.o: unprotoize.c protoize.c $(srcdir)/../include/getopt.h \
$(CONFIG_H) system.h Makefile
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
- -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
- -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
- -DCROSS_INCLUDE_DIR=\"$(gcc_tooldir)/sys-include\" \
- -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \
- -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
- -DSTD_PROTO_DIR=\"$(libsubdir)\" \
+ $(DRIVER_DEFINES) $(PREPROCESSOR_DEFINES) \
$(srcdir)/unprotoize.c
# This info describes the target machine, so compile with GCC just built.
@@ -2048,22 +2036,26 @@ PROTO_OBJS = getpwd.o intl.o version.o
cp $(srcdir)/protoize.c tmp-proto.c
chmod u+w tmp-proto.c
./protoize -N -B ./ -x getopt.h -c "-B./ -Wall -Wwrite-strings \
- $(CFLAGS) $(INCLUDES) \
+ $(GCC_CFLAGS) $(INCLUDES) \
-DGCC_INCLUDE_DIR=0 \
-DGPLUSPLUS_INCLUDE_DIR=0 \
-DCROSS_INCLUDE_DIR=0 \
-DTOOL_INCLUDE_DIR=0 \
- -DSTD_PROTO_DIR=0" tmp-proto.c
+ -DSTANDARD_EXEC_PREFIX=0 \
+ -DDEFAULT_TARGET_MACHINE=0 \
+ -DDEFAULT_TARGET_VERSION=0" tmp-proto.c
@echo '**********' Expect 400 lines of differences.
-diff $(srcdir)/protoize.c tmp-proto.c > tmp-proto.diff
-wc -l tmp-proto.diff
./unprotoize -N -x getopt.h -c "-B./ -Wall -Wwrite-strings \
- $(CFLAGS) $(INCLUDES) \
+ $(GCC_CFLAGS) $(INCLUDES) \
-DGCC_INCLUDE_DIR=0 \
-DGPLUSPLUS_INCLUDE_DIR=0 \
-DCROSS_INCLUDE_DIR=0 \
-DTOOL_INCLUDE_DIR=0 \
- -DSTD_PROTO_DIR=0" tmp-proto.c
+ -DSTANDARD_EXEC_PREFIX=0 \
+ -DDEFAULT_TARGET_MACHINE=0 \
+ -DDEFAULT_TARGET_VERSION=0" tmp-proto.c
@echo Expect zero differences.
diff $(srcdir)/protoize.c tmp-proto.c | cat
-rm -f tmp-proto.[cs] tmp-proto$(objext)
--- /sloth/disk0/co/egcs-mainline/egcs/gcc/protoize.c Thu Jul 22 12:50:45 1999
+++ egcs/gcc/protoize.c Mon Aug 16 15:38:05 1999
@@ -111,9 +111,9 @@ extern char *version_string;
extern char *getpwd ();
-static void usage PROTO ((void)) ATTRIBUTE_NORETURN;
-static void aux_info_corrupted PROTO ((void)) ATTRIBUTE_NORETURN;
-static void declare_source_confusing PROTO ((const char *)) ATTRIBUTE_NORETURN;
+static void usage PARAMS ((void)) ATTRIBUTE_NORETURN;
+static void aux_info_corrupted PARAMS ((void)) ATTRIBUTE_NORETURN;
+static void declare_source_confusing PARAMS ((const char *)) ATTRIBUTE_NORETURN;
/* Aliases for pointers to void.
These were made to facilitate compilation with old brain-dead DEC C
@@ -165,9 +165,21 @@ extern size_t strlen ()
/* Define a default place to find the SYSCALLS.X file. */
-#ifndef STD_PROTO_DIR
-#define STD_PROTO_DIR "/usr/local/lib"
-#endif /* !defined (STD_PROTO_DIR) */
+#ifndef UNPROTOIZE
+
+#ifndef STANDARD_EXEC_PREFIX
+#define STANDARD_EXEC_PREFIX "/usr/local/lib/gcc-lib/"
+#endif /* !defined STANDARD_EXEC_PREFIX */
+
+static char *standard_exec_prefix = STANDARD_EXEC_PREFIX;
+static char *target_machine = DEFAULT_TARGET_MACHINE;
+static char *target_version = DEFAULT_TARGET_VERSION;
+
+#ifndef GET_ENV_PATH_LIST
+#define GET_ENV_PATH_LIST(VAR,NAME) do { (VAR) = getenv (NAME); } while (0)
+#endif
+
+#endif /* !defined (UNPROTOIZE) */
/* Suffix of aux_info files. */
@@ -187,7 +199,7 @@ static const char syscalls_filename[] =
/* Default place to find the above file. */
-static const char * const default_syscalls_dir = STD_PROTO_DIR;
+static char * default_syscalls_dir;
/* Variable to hold the complete absolutized filename of the SYSCALLS.c.X
file. */
@@ -569,10 +581,10 @@ static char * saved_repl_write_ptr;
static const char *shortpath ();
/* Translate and output an error message. */
-static void notice PVPROTO ((const char *, ...))
+static void notice PARAMS ((const char *, ...))
ATTRIBUTE_PRINTF_1;
static void
-notice VPROTO ((const char *msgid, ...))
+notice VPARAMS ((const char *msgid, ...))
{
#ifndef ANSI_PROTOTYPES
const char *msgid;
@@ -592,7 +604,7 @@ notice VPROTO ((const char *msgid, ...))
char *
xstrerror(e)
- int e;
+ int e;
{
#ifdef HAVE_STRERROR
@@ -614,7 +626,7 @@ char *
pointer_type
xmalloc (byte_count)
- size_t byte_count;
+ size_t byte_count;
{
register pointer_type rv = (pointer_type) malloc (byte_count);
if (rv == NULL)
@@ -4458,16 +4470,27 @@ do_processing ()
if (nondefault_syscalls_dir)
{
syscalls_absolute_filename
- = (char *) xmalloc (strlen (nondefault_syscalls_dir)
- + sizeof (syscalls_filename) + 1);
+ = (char *) xmalloc (strlen (nondefault_syscalls_dir) + 1
+ + sizeof (syscalls_filename));
strcpy (syscalls_absolute_filename, nondefault_syscalls_dir);
}
else
{
+ GET_ENV_PATH_LIST (default_syscalls_dir, "GCC_EXEC_PREFIX");
+ if (!default_syscalls_dir)
+ {
+ default_syscalls_dir = standard_exec_prefix;
+ }
syscalls_absolute_filename
- = (char *) xmalloc (strlen (default_syscalls_dir)
- + sizeof (syscalls_filename) + 1);
+ = (char *) xmalloc (strlen (default_syscalls_dir) + 0
+ + strlen (target_machine) + 1
+ + strlen (target_version) + 1
+ + sizeof (syscalls_filename));
strcpy (syscalls_absolute_filename, default_syscalls_dir);
+ strcat (syscalls_absolute_filename, target_machine);
+ strcat (syscalls_absolute_filename, "/");
+ strcat (syscalls_absolute_filename, target_version);
+ strcat (syscalls_absolute_filename, "/");
}
syscalls_len = strlen (syscalls_absolute_filename);
============================================================