This is the mail archive of the gcc-bugs@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]

Code rot exposed


The patch to configure.in (enable-nls) on May 31 exposed the following problem:

gcc -c -DLOCALEDIR=\"/usr/local/share/locale\" -DGNULOCALEDIR=\"/usr/local/share/locale\" -DLOCALE_ALIAS_PATH=\"/usr/local/share/locale:.\" -DHAVE_CONFIG_H -I.. -I. -I../../../gcc/intl -I../../../gcc/lib  -g  -W -Wall -Wtraditional -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -pedantic -Wno-long-long  ../../../gcc/intl/localealias.c
../../../gcc/intl/localealias.c:47: warning: function declaration isn't a prototype
../../../gcc/intl/localealias.c:51: warning: function declaration isn't a prototype
In file included from ../../../gcc/intl/localealias.c:73:
../../../gcc/intl/gettextP.h:49: warning: ANSI does not permit the keyword `inline'
../../../gcc/intl/localealias.c: In function `_nl_expand_alias':
../../../gcc/intl/localealias.c:172: warning: implicit declaration of function `bsearch'
../../../gcc/intl/localealias.c: In function `read_alias_file':
../../../gcc/intl/localealias.c:258: warning: pointer targets in passing arg 1 of `fgets' differ in signedness
../../../gcc/intl/localealias.c:264: warning: pointer targets in passing arg 1 of `index' differ in signedness
../../../gcc/intl/localealias.c:317: warning: pointer targets in passing arg 1 of `strlen' differ in signedness
../../../gcc/intl/localealias.c:318: warning: pointer targets in passing arg 1 of `strlen' differ in signedness
../../../gcc/intl/localealias.c:326: warning: implicit declaration of function `realloc'
../../../gcc/intl/localealias.c:337: void value not ignored as it ought to be
../../../gcc/intl/localealias.c:341: void value not ignored as it ought to be
../../../gcc/intl/localealias.c:355: warning: implicit declaration of function `qsort'
../../../gcc/intl/localealias.c: In function `extend_alias_table':
../../../gcc/intl/localealias.c:370: warning: function `realloc' was previously declared within a block
make[4]: *** [localealias.o] Error 1

The errors at line 337 and 341 are due to substituting bcopy for memcpy.  The
two functions have different return types, void and void *, respectively.
The code uses the memcpy return pointer and thus needs to be fixed if the
bcopy substitution is to work.

The substitution occurs because -DIN_GCC is not defined when config.h is
included.  If this is defined, then it exposes another problem.  The
INCLUDES definition in intl/Makefile is wrong.

The patch to function.c on June 2, seems to have created another problem:

gcc -c  -DIN_GCC    -g  -W -Wall -Wtraditional -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -pedantic -Wno-long-long  -DHAVE_CONFIG_H    -I. -I../../gcc -I../../gcc/config -I../../gcc/../include ../../gcc/function.c
../../gcc/function.c:280: warning: static declaration for `round_down' follows non-static
../../gcc/function.c: In function `instantiate_decls':
../../gcc/function.c:3439: warning: comparison between signed and unsigned
../../gcc/function.c: In function `assign_parms':
../../gcc/function.c:4643: too few arguments to function `set_mem_attributes'
../../gcc/function.c: At top level:
../../gcc/function.c:280: warning: `round_down' used but never defined
make[2]: *** [function.o] Error 1

Here is a patch that works around the bcopy problem:

--- intl/Makefile.in.orig	Tue Feb  2 13:49:16 1999
+++ intl/Makefile.in	Sat Jun  3 21:42:30 2000
@@ -48,7 +48,7 @@
 LIBTOOL = @LIBTOOL@
 RANLIB = @RANLIB@
 
-DEFS = -DLOCALEDIR=\"$(localedir)\" -DGNULOCALEDIR=\"$(gnulocaledir)\" \
+DEFS = -DIN_GCC -DLOCALEDIR=\"$(localedir)\" -DGNULOCALEDIR=\"$(gnulocaledir)\" \
 -DLOCALE_ALIAS_PATH=\"$(aliaspath)\" @DEFS@
 CPPFLAGS = @CPPFLAGS@
 CFLAGS = @CFLAGS@
@@ -79,7 +79,7 @@
 .c.lo:
 	$(LIBTOOL) --mode=compile $(COMPILE) $<
 
-INCLUDES = -I.. -I. -I$(top_srcdir)/intl -I$(top_srcdir)/lib
+INCLUDES = -I.. -I. -I$(top_srcdir) -I$(top_srcdir)/intl -I$(top_srcdir)/config
 
 all: all-@USE_INCLUDED_LIBINTL@
 
Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

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