From: twpierce@unix.amherst.edu (Tim Pierce) Subject: gcc -traditional and memcpy Date: Wed, 14 Apr 1993 05:32:19 GMT
I haven't seen this mentioned in the FAQ. Please excuse me if it's
old territory.
I'm running 0.99.7a of the kernel and a fairly recent SLS distribution
with gcc 2.3.3 and libc-4.3.3. While trying to make rpcgen, snavtched
from wuarchive (why? I had this paranoid vision of losing part of the
source for mount and needing to rebuild the various modules from
mount.x by hand), I noticed that compiling a program referencing
memcpy or memcmp with the -traditional switch yields the following
error messages:
# gcc -O -traditional test.c
In file included from test.c:1:
/usr/include/string.h:38: warning: conflicting types for built-in function `memcpy'
/usr/include/string.h:38: warning: type mismatch with previous external decl
<built-in>:0: warning: previous external decl of `memcpy'
/usr/include/string.h:63: warning: conflicting types for built-in function `memcmp'
/usr/include/string.h:63: warning: type mismatch with previous external decl
<built-in>:0: warning: previous external decl of `memcmp'
Since experimentation on Ultrix and SunOS systems didn't produce the
same problem, I poked around a little in the Linux include files and
found the inlined functions for memcmp, memcpy, and the various string
functions in include/linux/string.h under the Linux source directory.
I presume that what's happening is that the GNU include files in
/usr/include provide prototypes that clash with the ones defined in
the kernel. Granted, the example above demonstrates only warning
messages that don't impede the linking of a working executable, but
(a) it would be nice to eliminate the warnings if possible, and (b)
it's simply never a good idea to let incompatibilities like this
linger, for they may come back to haunt you when you can least deal
with it.
Might it be a good idea to fiddle with the GNU-supplied include files
so that they jibe with the kernel prototypes? Or, for that matter,
should the kernel prototypes be changed to work with the GNU include
files?
-- ____ Tim Pierce / ?Usted es la de la tele, eh? !La madre \ / twpierce@unix.amherst.edu / del asesino! !Ay, que graciosa! \/ (BITnet: TWPIERCE@AMHERST) / -- Pedro Almodovar