OSDN Git Service

Use one makefile for fixinc
authorkorbb <korbb@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 13 Dec 2000 20:07:46 +0000 (20:07 +0000)
committerkorbb <korbb@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 13 Dec 2000 20:07:46 +0000 (20:07 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@38231 138bc75d-0d04-0410-961f-82ee72b054a4

12 files changed:
gcc/ChangeLog
gcc/fixinc/Makefile.in
gcc/fixinc/fixfixes.c
gcc/fixinc/fixincl.c
gcc/fixinc/fixlib.h
gcc/fixinc/fixtests.c
gcc/fixinc/genfixes
gcc/fixinc/gnu-regex.c
gcc/fixinc/mkfixinc.sh
gcc/fixinc/procopen.c
gcc/fixinc/server.c
gcc/fixinc/server.h

index 637029b..79fa00c 100644 (file)
@@ -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,
index 6213ffd..8615518 100644 (file)
@@ -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
index 05e7008..56b9f54 100644 (file)
@@ -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;
index 195dbfe..68914e2 100644 (file)
@@ -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);
 
index 9bef8b1..4490d20 100644 (file)
@@ -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 */
 
index 75d66c1..e3da35b 100644 (file)
@@ -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");
 
index 4c0b7d5..952eccd 100755 (executable)
@@ -63,7 +63,7 @@ if [ $# -eq 0 ] ; then
   set -- fixincl.x
 fi
 
-AG="autogen $AG"
+AG="autogen4 $AG"
 set -e
 
 case "$1" in
index 4b71a4d..0152e9f 100644 (file)
@@ -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
 
 # 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 */
 \f
 /* 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)
index ec9cdbc..5bb6a55 100755 (executable)
@@ -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
 
index ed50e0b..91566eb 100644 (file)
 #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);
index 7287ed9..e32576f 100644 (file)
 
 #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");
index 2f016f4..c3ed6c7 100644 (file)
@@ -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 */