This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
fixincl patch suggestions
- To: gcc-patches at gcc dot gnu dot org (gcc-patches at gcc dot gnu dot org)
- Subject: fixincl patch suggestions
- From: "Philippe De Muyter" <phdm at macqel dot be>
- Date: Tue, 18 Apr 2000 03:11:09 +0200 (CEST)
Hi Bruce,
I have a big problem with the binary version of fixincl, because it falls
in an endless loop in `fwrite', or `fputs' if I bypass `fwrite'. I do not
know yet why and hence I do not yet have a fix for that.
But while trying to debug that, I fell on two problems.
1. You use #include "a_C_program.c". That is bad practice and makes debugging
impossible for me, because the COFF format, that I need to use, can not
cope with that, and hence gdb gives me the line number from the included file
but presents me the main file. I would suggest you to split fixfixes.c and
fixtests.c into the library part, that I called fixfixeslib.c and fixtestslib.c,
and the main part for which I kept the original name.
2. The `install' rule in fixinc/Makefile first installs `fixinc.sh' and later
`fixincl', but is only triggered in gcc/Makefile if `fixinc.sh' is out of date.
If for some reason, the installation of `fixincl' fails, it will never be
retried because `fixinc.sh' is updated. For me the reason was that `fixincl'
was still running, and one cannot overwrite the text of a running program.
I suggest you to first install `fixincl' and to install `fixinc.sh' thereafter.
The patches to the Makefile's are below, but the split of `fixfixes.c' and
`fixtests.c' is left to you, to not make this message too long.
Philippe
Index: gcc/Makefile.in
===================================================================
RCS file: /cvs/gcc/egcs/gcc/Makefile.in,v
retrieving revision 1.419
diff -u -p -b -r1.419 Makefile.in
--- Makefile.in 2000/04/07 21:37:56 1.419
+++ Makefile.in 2000/04/18 00:12:21
@@ -2214,6 +2218,7 @@ specs.ready: specs
FIXINCSRCDIR=$(srcdir)/fixinc
fixinc.sh: $(FIXINCSRCDIR)/mkfixinc.sh $(FIXINCSRCDIR)/fixincl.c \
+ $(FIXINCSRCDIR)/fixfixeslib.c $(FIXINCSRCDIR)/fixtestslib.c \
$(FIXINCSRCDIR)/procopen.c $(FIXINCSRCDIR)/gnu-regex.c \
$(FIXINCSRCDIR)/server.c $(FIXINCSRCDIR)/gnu-regex.h \
$(FIXINCSRCDIR)/server.h $(FIXINCSRCDIR)/inclhack.def specs.ready
Index: gcc/fixinc/Makefile.in
===================================================================
RCS file: /cvs/gcc/egcs/gcc/fixinc/Makefile.in,v
retrieving revision 1.18
diff -u -p -b -r1.18 Makefile.in
--- Makefile.in 2000/02/11 20:20:14 1.18
+++ Makefile.in 2000/04/18 00:12:46
@@ -61,7 +61,7 @@ INCLUDES = -I. -I.. -I$(srcdir) -I$(srcd
LIBERTY = ../../libiberty/libiberty.a
LIBOBJ = gnu-regex.o fixlib.o $(LIBERTY)
-FIOBJ = fixincl.o server.o procopen.o $(LIBOBJ)
+FIOBJ = fixincl.o fixfixeslib.o fixtestslib.o server.o procopen.o $(LIBOBJ)
HDR = server.h gnu-regex.h fixlib.h machname.h
@@ -82,15 +82,19 @@ fixincl: $(FIOBJ)
rm -f $@ ; (echo "#! /bin/sh" ; echo exit 1 ) > $@ ; \
chmod 777 $@ ; fi
-fixfixes: fixfixes.c $(LIBOBJ)
- $(CC) -o $@ $(FIXINC_DEFS) -DMAIN \
- $(srcdir)/fixfixes.c $(LIBOBJ) $(LIB)
-
-fixtests: fixtests.c $(LIBOBJ)
- $(CC) -o $@ $(FIXINC_DEFS) -DMAIN \
- $(srcdir)/fixtests.c $(LIBOBJ) $(LIB)
-
-fixincl.o : fixincl.x fixincl.c fixfixes.c fixtests.c
+FIXFIXES_OBJ = fixfixes.o fixfixeslib.o $(LIBOBJ)
+fixfixes: $(FIXFIXES_OBJ)
+ $(CC) -o $@ $(FIXFIXES_OBJ) $(LIB)
+
+FIXTESTS_OBJ = fixtests.o fixtestslib.o $(LIBOBJ)
+fixtests: $(FIXTESTS_OBJ)
+ $(CC) -o $@ $(FIXTESTS_OBJ) $(LIB)
+
+fixincl.o : fixincl.x fixincl.c
+fixfixes.o : fixfixes.c
+fixfixeslib.o : fixfixeslib.c
+fixtests.o : fixtests.c
+fixtestslib.o : fixtestslib.c
server.o : server.c server.h
procopen.o : procopen.c server.h
fixlib.o: machname.h
@@ -116,15 +120,15 @@ clean:
install: $(TARGETS)
@rm -f ../fixinc.sh ; \
if ( ./fixincl -v > /dev/null 2>&1 ) ; then \
+ rm -f ../fixincl ; \
+ echo cp fixincl .. ; \
+ cp fixincl .. ; \
+ chmod 555 ../fixincl ; \
echo cp fixincl.sh ../fixinc.sh ; \
if [ -f ./fixincl.sh ] ; \
then cp fixincl.sh ../fixinc.sh ; \
else cp $(srcdir)/fixincl.sh ../fixinc.sh ; fi ; \
chmod 555 ../fixinc.sh ; \
- rm -f ../fixincl ; \
- echo cp fixincl .. ; \
- cp fixincl .. ; \
- chmod 555 ../fixincl ; \
else \
echo Could not install binary fixincludes. ; \
echo Installing shell script instead. ; \