summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorkorbb <korbb@138bc75d-0d04-0410-961f-82ee72b054a4>2000-12-13 20:07:46 +0000
committerkorbb <korbb@138bc75d-0d04-0410-961f-82ee72b054a4>2000-12-13 20:07:46 +0000
commit5beb4ba097ebc3d2d87ee799606ae7789547c89a (patch)
treeaa77d1e180b5de6f18f88e4ec71062700cc5d417 /gcc
parent370f8928be64012444d56f6d5392d77fe148096f (diff)
downloadgcc-5beb4ba097ebc3d2d87ee799606ae7789547c89a.tar.gz
Use one makefile for fixinc
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@38231 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog18
-rw-r--r--gcc/fixinc/Makefile.in39
-rw-r--r--gcc/fixinc/fixfixes.c9
-rw-r--r--gcc/fixinc/fixincl.c4
-rw-r--r--gcc/fixinc/fixlib.h10
-rw-r--r--gcc/fixinc/fixtests.c1
-rwxr-xr-xgcc/fixinc/genfixes2
-rw-r--r--gcc/fixinc/gnu-regex.c19
-rwxr-xr-xgcc/fixinc/mkfixinc.sh33
-rw-r--r--gcc/fixinc/procopen.c41
-rw-r--r--gcc/fixinc/server.c34
-rw-r--r--gcc/fixinc/server.h25
12 files changed, 95 insertions, 140 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 637029bb2f7..79fa00c92d7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,21 @@
+2000-12-13 Bruce Korb <bkorb@gnu.org>
+
+ * fixinc/Makefile.in(*): substantial rewrite to accommodate systems
+ that cannot handle bi-directional pipes, viz. BeOS and DOS.
+ * fixinc/fixlib.h(IGNORE_ARG): new macro
+ (STATIC): define for all of fixinc to use
+ * fixinc/fixfixes.c(*): eliminate unused arg warnings
+ * fixinc/fixtests.c(*): ditto
+ * fixinc/fixincl.c(start_fixer): chain_open now uses const arg list
+ * fixinc/gnu-regex.c: reorder some includes to avoid _GNU_SOURCE
+ warning. Also, eliminate the ``#ifdef emacs'' stuff.
+ (re_syntax_options): make global as it is declared so.
+ * fixinc/mkfixinc.sh: process the argument list more consistently
+ (beos/msdosdjgpp): set TARGETS to twoprocess vs. oneprocess
+ * fixinc/procopen.c(globals): include "fixlib.h" for std defs
+ * fixinc/server.c(globals): ditto
+ * fixinc/server.h(defines): ditto
+
2000-12-13 Neil Booth <neil@daikokuya.demon.co.uk>
* tradcpp.c (special_symbol): Improve test for definedness,
diff --git a/gcc/fixinc/Makefile.in b/gcc/fixinc/Makefile.in
index 6213ffd12b8..86155182b6f 100644
--- a/gcc/fixinc/Makefile.in
+++ b/gcc/fixinc/Makefile.in
@@ -59,23 +59,38 @@ INCLUDES = -I. -I.. -I$(srcdir) -I$(srcdir)/.. \
## # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
LIBERTY = ../../libiberty/libiberty.a
-OBJ = fixincl.o fixtests.o fixfixes.o server.o procopen.o \
+
+ALLOBJ = fixincl.o fixtests.o fixfixes.o server.o procopen.o \
gnu-regex.o fixlib.o
-HDR = server.h gnu-regex.h fixlib.h machname.h
+TESTOBJ = fixincl.o fixlib.o fixtests.o gnu-regex.o
+FIXOBJ = fixfixes.o fixlib.o gnu-regex.o
-TARGETS = fixincl@build_exeext@
+HDR = server.h gnu-regex.h fixlib.h machname.h
+FI = fixincl@build_exeext@
+AF = applyfix@build_exeext@
all : $(TARGETS)
gen : $(srcdir)/fixincl.x
-fixincl@build_exeext@: $(OBJ) $(LIBERTY)
- $(CC) $(FIXINC_DEFS) $(LDFLAGS) -o $@ $(OBJ) $(LIBERTY)
+oneprocess : full-stamp
+twoprocess : test-stamp $(AF)
+
+full-stamp : $(ALLOBJ) $(LIBERTY)
+ $(CC) $(FIXINC_DEFS) $(LDFLAGS) -o $(FI) $(ALLOBJ) $(LIBERTY)
+ touch $@
+
+test-stamp : $(TESTOBJ) $(LIBERTY)
+ $(CC) $(FIXINC_DEFS) $(LDFLAGS) -o $(FI) $(TESTOBJ) $(LIBERTY)
+ touch $@
+
+$(AF): $(FIXOBJ) $(LIBERTY)
+ $(CC) $(FIXINC_DEFS) $(LDFLAGS) -o $@ $(FIXOBJ) $(LIBERTY)
-$(OBJ) : $(HDR)
-fixincl.o : $(srcdir)/fixincl.x fixincl.c
+$(ALLOBJ) : $(HDR)
+fixincl.o : fixincl.c $(srcdir)/fixincl.x
fixtests.o : fixtests.c
-fixfixes.o : fixfixes.c
+fixfixes.o : fixfixes.c $(srcdir)/fixincl.x
server.o : server.c
procopen.o : procopen.c
gnu-regex.o : gnu-regex.c
@@ -91,7 +106,7 @@ $(srcdir)/fixincl.x: fixincl.tpl inclhack.def
cd $(srcdir) ; $(SHELL) ./genfixes $@
clean:
- rm -f *.o $(TARGETS) machname.h *~
+ rm -f *.o *-stamp $(AF) $(FI) machname.h *~
maintainer-clean : clean
rm -f $(srcdir)/fixincl.x
@@ -103,11 +118,7 @@ install-bin : $(TARGETS)
./fixincl -v
@if [ -f ../fixinc.sh ] ; then rm -f ../fixinc.sh || \
mv -f ../fixinc.sh ../fixinc.sh.$$ || exit 1 ; fi
- @if [ -f ./fixincl.sh ] ; \
- then echo cp ./fixincl.sh ../fixinc.sh ; \
- cp ./fixincl.sh ../fixinc.sh ; \
- else echo cp $(srcdir)/fixincl.sh ../fixinc.sh ; \
- cp $(srcdir)/fixincl.sh ../fixinc.sh ; fi
+ @cp $(srcdir)/fixincl.sh ../fixinc.sh
chmod 755 ../fixinc.sh
Makefile: Makefile.in ../config.status
diff --git a/gcc/fixinc/fixfixes.c b/gcc/fixinc/fixfixes.c
index 05e70089461..56b9f5493c7 100644
--- a/gcc/fixinc/fixfixes.c
+++ b/gcc/fixinc/fixfixes.c
@@ -257,6 +257,7 @@ FIX_PROC_HEAD( format_fix )
tCC* pz_fmt = p_fixd->patch_args[1];
regex_t re;
regmatch_t rm[10];
+ IGNORE_ARG(filname);
/*
* We must have a format
@@ -335,6 +336,7 @@ FIX_PROC_HEAD( char_macro_use_fix )
regmatch_t rm[1];
const char *p, *limit;
size_t len;
+ IGNORE_ARG(filname);
if (str == NULL)
{
@@ -419,6 +421,7 @@ FIX_PROC_HEAD( char_macro_def_fix )
const char *p, *limit;
char arg;
size_t len;
+ IGNORE_ARG(filname);
if (str == NULL)
{
@@ -511,6 +514,8 @@ FIX_PROC_HEAD( machine_name_fix )
regex_t *label_re, *name_re;
char scratch[SCRATCHSZ];
size_t len;
+ IGNORE_ARG(filname);
+ IGNORE_ARG(p_fixd);
mn_get_regexps (&label_re, &name_re, "machine_name_fix");
@@ -598,7 +603,7 @@ FIX_PROC_HEAD( machine_name_fix )
FIX_PROC_HEAD( wrap_fix )
{
tSCC z_no_wrap_pat[] = "^#if.*__need_";
- static regex_t no_wrapping_re = { NULL, 0, 0 };
+ static regex_t no_wrapping_re; /* assume zeroed data */
char z_fixname[ 64 ];
tCC* pz_src = p_fixd->fix_name;
@@ -606,6 +611,7 @@ FIX_PROC_HEAD( wrap_fix )
char* pz_dst = z_fixname;
int do_end = 0;
size_t len = 0;
+ IGNORE_ARG(filname);
if (no_wrapping_re.allocated == 0)
compile_re( z_no_wrap_pat, &no_wrapping_re, 0, "no-wrap pattern",
@@ -670,6 +676,7 @@ FIX_PROC_HEAD( gnu_type_fix )
const char* pz_pat;
regex_t re;
regmatch_t rm[GTYPE_SE_CT+1];
+ IGNORE_ARG(filname);
{
tTestDesc* pTD = p_fixd->p_test_desc;
diff --git a/gcc/fixinc/fixincl.c b/gcc/fixinc/fixincl.c
index 195dbfe4de6..68914e2cbca 100644
--- a/gcc/fixinc/fixincl.c
+++ b/gcc/fixinc/fixincl.c
@@ -1,4 +1,4 @@
-
+:1066
/* Install modified versions of certain ANSI-incompatible system header
files which are fixed to work correctly with ANSI C and placed in a
directory that GNU C will search.
@@ -1066,7 +1066,7 @@ start_fixer (read_fd, p_fixd, pz_fix_file)
int fd;
fd = chain_open (read_fd,
- (t_pchar *) p_fixd->patch_args,
+ (tCC **) p_fixd->patch_args,
(process_chain_head == -1)
? &process_chain_head : (pid_t *) NULL);
diff --git a/gcc/fixinc/fixlib.h b/gcc/fixinc/fixlib.h
index 9bef8b14863..4490d2086ea 100644
--- a/gcc/fixinc/fixlib.h
+++ b/gcc/fixinc/fixlib.h
@@ -51,6 +51,11 @@ typedef int t_success;
#define FAILED(p) ((p) < SUCCESS)
#define HADGLITCH(p) ((p) > SUCCESS)
+#ifndef DEBUG
+# define STATIC static
+#else
+# define STATIC
+#endif
#define tSCC static const char
#define tCC const char
@@ -81,13 +86,12 @@ typedef int t_success;
#define EXIT_PANIC 99
#endif /* NOPROCESS */
-#ifndef HAVE_T_BOOL_ENUM
-#define HAVE_T_BOOL_ENUM
+#define IGNORE_ARG(a) ((void)(a))
+
typedef enum
{
BOOL_FALSE, BOOL_TRUE
} t_bool;
-#endif
typedef int apply_fix_p_t; /* Apply Fix Predicate Type */
diff --git a/gcc/fixinc/fixtests.c b/gcc/fixinc/fixtests.c
index 75d66c17474..e3da35b8c36 100644
--- a/gcc/fixinc/fixtests.c
+++ b/gcc/fixinc/fixtests.c
@@ -72,6 +72,7 @@ TEST_FOR_FIX_PROC_HEAD( machine_name_test )
regex_t *label_re, *name_re;
regmatch_t match[2];
tCC *base, *limit;
+ IGNORE_ARG(fname);
mn_get_regexps(&label_re, &name_re, "machine_name_test");
diff --git a/gcc/fixinc/genfixes b/gcc/fixinc/genfixes
index 4c0b7d57286..952eccdf829 100755
--- a/gcc/fixinc/genfixes
+++ b/gcc/fixinc/genfixes
@@ -63,7 +63,7 @@ if [ $# -eq 0 ] ; then
set -- fixincl.x
fi
-AG="autogen $AG"
+AG="autogen4 $AG"
set -e
case "$1" in
diff --git a/gcc/fixinc/gnu-regex.c b/gcc/fixinc/gnu-regex.c
index 4b71a4dd2f9..0152e9fdcd2 100644
--- a/gcc/fixinc/gnu-regex.c
+++ b/gcc/fixinc/gnu-regex.c
@@ -22,6 +22,8 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+#include "auto-host.h"
+
#undef _GNU_SOURCE
#define _GNU_SOURCE
@@ -76,18 +78,6 @@
# define gettext_noop(String) String
#endif
-/* The `emacs' switch turns on certain matching commands
- that make sense only in Emacs. */
-#ifdef emacs
-
-# include "lisp.h"
-# include "buffer.h"
-# include "syntax.h"
-
-#else /* not emacs */
-
-# include "auto-host.h"
-
# if !defined(volatile) && !defined(HAVE_VOLATILE)
# define volatile
# endif
@@ -191,8 +181,6 @@ init_syntax_once ()
# endif /* not SYNTAX_TABLE */
# define SYNTAX(c) re_syntax_table[c]
-
-#endif /* not emacs */
/* Get the interface, including the syntax bits. */
/* GCC LOCAL: call it gnu-regex.h, not regex.h, to avoid name conflicts */
@@ -922,7 +910,7 @@ printchar (c)
syntax, so it can be changed between regex compilations. */
/* This has no initializer because initialized variables in Emacs
become read-only after dumping. */
-static reg_syntax_t re_syntax_options;
+reg_syntax_t re_syntax_options;
/* Specify the precise syntax of regexps for compilation. This provides
@@ -5710,6 +5698,7 @@ regerror (errcode, preg, errbuf, errbuf_size)
{
const char *msg;
size_t msg_size;
+ (void)preg;
if (errcode < 0
|| errcode >= (int) (sizeof (re_error_msgid)
diff --git a/gcc/fixinc/mkfixinc.sh b/gcc/fixinc/mkfixinc.sh
index ec9cdbcb985..5bb6a5502c9 100755
--- a/gcc/fixinc/mkfixinc.sh
+++ b/gcc/fixinc/mkfixinc.sh
@@ -1,39 +1,30 @@
#! /bin/sh
-build=$1
-machine=$2
-
-if [ -z "$build" ]
-then
- echo No target system name given
- exit 1
-fi
-
-# If we don't get two arguments, then assume both arguments
-# are the same
-#
-if [ -z "$machine" ]
+if [ $# -ne 2 ]
then
- machine="$build"
+ echo "Usage: $0 <build-mach-triplet> <target-mach-triplet>"
+ exit 1
fi
+build=$1
+machine=$2
target=../fixinc.sh
echo constructing ${target} for $machine to run on $build
fixincludes="${machine}"
-# Choose fix build method by build system
+# Choose one or two-process fix methodology. Systems that cannot handle
+# bi-directional pipes must use the twoprocess method.
+#
case $build in
- i?86-*-msdosdjgpp* )
- MAKE="${MAKE} -f ${srcdir}/Makefile.DOS srcdir=${srcdir}"
- ;;
-
+ i?86-*-msdosdjgpp* | \
*-*-beos* )
- MAKE="${MAKE} -f ${srcdir}/Makefile.BEOS srcdir=${srcdir}"
+ MAKE="${MAKE} TARGETS=twoprocess"
+ CFLAGS="${CFLAGS} -DSEPARATE_FIX_PROC"
;;
* )
- MAKE="${MAKE} -f Makefile"
+ MAKE="${MAKE} TARGETS=oneprocess"
;;
esac
diff --git a/gcc/fixinc/procopen.c b/gcc/fixinc/procopen.c
index ed50e0b4ed5..91566eb5a95 100644
--- a/gcc/fixinc/procopen.c
+++ b/gcc/fixinc/procopen.c
@@ -50,34 +50,9 @@
#include "system.h"
#include "server.h"
+#include "fixlib.h"
-/* If this particular system's header files define the macro `MAXPATHLEN',
- we happily take advantage of it; otherwise we use a value which ought
- to be large enough. */
-#ifndef MAXPATHLEN
-# define MAXPATHLEN 4096
-#endif
-
-#ifndef STDIN_FILENO
-# define STDIN_FILENO 0
-#endif
-#ifndef STDOUT_FILENO
-# define STDOUT_FILENO 1
-#endif
-
-#ifdef DEBUG
-#define STATIC
-#else
-#define STATIC static
-#endif
-#ifndef tSCC
-#define tSCC static const char
-#endif
-#ifndef NUL
-#define NUL '\0'
-#endif
-
-STATIC t_pchar def_args[] =
+STATIC const char* def_args[] =
{ (char *) NULL, (char *) NULL };
/*
@@ -92,12 +67,12 @@ STATIC t_pchar def_args[] =
int
chain_open (stdin_fd, pp_args, p_child)
int stdin_fd;
- t_pchar *pp_args;
+ tCC **pp_args;
pid_t *p_child;
{
t_fd_pair stdout_pair;
pid_t ch_id;
- char *pz_cmd;
+ tCC *pz_cmd;
stdout_pair.read_fd = stdout_pair.write_fd = -1;
@@ -115,7 +90,7 @@ chain_open (stdin_fd, pp_args, p_child)
/*
* If we did not get an arg list, use the default
*/
- if (pp_args == (t_pchar *) NULL)
+ if (pp_args == (tCC **) NULL)
pp_args = def_args;
/*
@@ -192,7 +167,7 @@ chain_open (stdin_fd, pp_args, p_child)
if (*pp_args == (char *) NULL)
*pp_args = pz_cmd;
- execvp (pz_cmd, pp_args);
+ execvp (pz_cmd, (char**)pp_args);
fprintf (stderr, "Error %d: Could not execvp( '%s', ... ): %s\n",
errno, pz_cmd, xstrerror (errno));
exit (EXIT_PANIC);
@@ -212,7 +187,7 @@ chain_open (stdin_fd, pp_args, p_child)
pid_t
proc2_open (p_pair, pp_args)
t_fd_pair *p_pair;
- t_pchar *pp_args;
+ tCC **pp_args;
{
pid_t ch_id;
@@ -239,7 +214,7 @@ proc2_open (p_pair, pp_args)
pid_t
proc2_fopen (pf_pair, pp_args)
t_pf_pair *pf_pair;
- t_pchar *pp_args;
+ tCC **pp_args;
{
t_fd_pair fd_pair;
pid_t ch_id = proc2_open (&fd_pair, pp_args);
diff --git a/gcc/fixinc/server.c b/gcc/fixinc/server.c
index 7287ed9d25d..e32576fca51 100644
--- a/gcc/fixinc/server.c
+++ b/gcc/fixinc/server.c
@@ -53,32 +53,6 @@
#include "server.h"
-/* If this particular system's header files define the macro `MAXPATHLEN',
- we happily take advantage of it; otherwise we use a value which ought
- to be large enough. */
-#ifndef MAXPATHLEN
-# define MAXPATHLEN 4096
-#endif
-
-#ifndef STDIN_FILENO
-# define STDIN_FILENO 0
-#endif
-#ifndef STDOUT_FILENO
-# define STDOUT_FILENO 1
-#endif
-
-#ifdef DEBUG
-#define STATIC
-#else
-#define STATIC static
-#endif
-#ifndef tSCC
-#define tSCC static const char
-#endif
-#ifndef NUL
-#define NUL '\0'
-#endif
-
#if !defined(volatile) && !defined(HAVE_VOLATILE)
# define volatile
#endif
@@ -86,7 +60,7 @@
STATIC volatile t_bool read_pipe_timeout;
STATIC pid_t server_master_pid = NOPROCESS;
-static t_pchar def_args[] =
+tSCC* def_args[] =
{ (char *) NULL, (char *) NULL };
STATIC t_pf_pair server_pair =
{ (FILE *) NULL, (FILE *) NULL };
@@ -97,7 +71,7 @@ STATIC pid_t server_id = NULLPROCESS;
* the terminating output line.
*/
tSCC z_done[] = "ShElL-OuTpUt-HaS-bEeN-cOmPlEtEd";
-STATIC t_pchar p_cur_dir = (char *) NULL;
+tSCC* p_cur_dir = (char *) NULL;
/*
* load_data
@@ -257,8 +231,8 @@ server_setup ()
* override with $CONFIG_SHELL, so we do the same.
*/
-static char *find_shell PARAMS ((void));
-static char *
+static const char *find_shell PARAMS ((void));
+static const char *
find_shell ()
{
char * shell = getenv ("CONFIG_SHELL");
diff --git a/gcc/fixinc/server.h b/gcc/fixinc/server.h
index 2f016f45e9c..c3ed6c7245f 100644
--- a/gcc/fixinc/server.h
+++ b/gcc/fixinc/server.h
@@ -54,6 +54,8 @@
#include <unistd.h>
#endif
+#include "fixlib.h"
+
/*
* Dual pipe opening of a child process
*/
@@ -70,27 +72,10 @@ typedef struct
FILE *pf_write; /* parent write fp */
} t_pf_pair;
-typedef char *t_pchar;
-
-#ifndef NOPROCESS
-#define NOPROCESS ((pid_t) -1)
-#define NULLPROCESS ((pid_t)0)
-
-#define EXIT_PANIC 99
-#endif /* NOPROCESS */
-
-#ifndef HAVE_T_BOOL_ENUM
-#define HAVE_T_BOOL_ENUM
-typedef enum
-{
- BOOL_FALSE, BOOL_TRUE
-} t_bool;
-#endif
-
char *run_shell PARAMS (( const char *pzCmd));
-pid_t proc2_fopen PARAMS (( t_pf_pair * p_pair, t_pchar * pp_args));
-pid_t proc2_open PARAMS (( t_fd_pair * p_pair, t_pchar * pp_args));
-int chain_open PARAMS (( int in_fd, t_pchar * pp_args,
+pid_t proc2_fopen PARAMS (( t_pf_pair * p_pair, tCC ** pp_args));
+pid_t proc2_open PARAMS (( t_fd_pair * p_pair, tCC ** pp_args));
+int chain_open PARAMS (( int in_fd, tCC ** pp_args,
pid_t * p_child));
void close_server PARAMS (( void ));
#endif /* FIXINC_SERVER_H */