Warnings compiling debug/warning-nop

Andreas Jaeger aj@suse.de
Sun Mar 27 20:50:00 GMT 2005


Roland McGrath <roland@frob.com> writes:

>> What about adding proper prototypes for these functions for older GCC
>> versions?
>
> You can just #define them away since the only part of the headers that
> matters for warning-nop.c is the __warndecl uses.

Like the following?  It compiles without warnings and generates the
link warning.

Andreas

Index: debug/warning-nop.c
===================================================================
RCS file: /cvs/glibc/libc/debug/warning-nop.c,v
retrieving revision 1.2
diff -u -p -r1.2 warning-nop.c
--- debug/warning-nop.c	1 Mar 2005 00:42:55 -0000	1.2
+++ debug/warning-nop.c	27 Mar 2005 20:49:15 -0000
@@ -37,4 +37,17 @@ nop (void)
 /* Following here we need an #include for each public header file
    that uses __warndecl.  */
 
+/* Define away to avoid warnings with compilers that do not have these
+   builtins.  */
+#define __builtin___memcpy_chk(dest, src, len, bos) NULL
+#define __builtin___memmove_chk(dest, src, len, bos) NULL
+#define __builtin___mempcpy_chk(dest, src, len, bos) NULL
+#define __builtin___memset_chk(dest, ch, len, bos) NULL
+#define __builtin___stpcpy_chk(dest, src, bos) NULL
+#define __builtin___strcat_chk(dest, src, bos) NULL
+#define __builtin___strcpy_chk(dest, src, bos) NULL
+#define __builtin___strncat_chk(dest, src, len, bos) NULL
+#define __builtin___strncpy_chk(dest, src, len, bos) NULL
+#define __builtin_object_size(bos, level) 0
+
 #include <string.h>

-- 
 Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj
  SUSE Linux Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
   GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-hacker/attachments/20050327/f3aa3749/attachment.sig>


More information about the Libc-hacker mailing list