public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* Warnings compiling debug/warning-nop
@ 2005-03-27 14:35 Andreas Jaeger
  2005-03-27 20:03 ` Roland McGrath
  0 siblings, 1 reply; 7+ messages in thread
From: Andreas Jaeger @ 2005-03-27 14:35 UTC (permalink / raw)
  To: Glibc hackers


[-- Attachment #1.1: Type: text/plain, Size: 1825 bytes --]


With GCC 4.0 I get these warnings compiling warning-nop.c:

In file included from ../include/bits/string3.h:1,
                 from ../string/string.h:422,
                 from ../include/string.h:49,
                 from warning-nop.c:40:
../string/bits/string3.h: In function ‘__memcpy_ichk’:
../string/bits/string3.h:51: warning: implicit declaration of function ‘__builtin___memcpy_chk’
../string/bits/string3.h:51: warning: implicit declaration of function ‘__builtin_object_size’
../string/bits/string3.h:51: warning: return makes pointer from integer without a cast
../string/bits/string3.h: In function ‘__memmove_ichk’:
../string/bits/string3.h:62: warning: implicit declaration of function ‘__builtin___memmove_chk’
../string/bits/string3.h:62: warning: return makes pointer from integer without a cast
[...]

These functions do not exist with GCC 4.0.  I propose the appended
patch which I've tested on i686-linux-gnu.  Ok to commit?

Andreas

2005-03-27  Andreas Jaeger  <aj@suse.de>

	* debug/warning-nop.c (__USE_FORTIFY_LEVEL): Only set with GCC 4.1
	or newer.


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 14:32:59 -0000
@@ -31,8 +31,10 @@ nop (void)
   extern void name (void) __attribute__ ((alias ("nop"))) attribute_hidden; \
   link_warning (name, msg)
 
-#undef	__USE_FORTIFY_LEVEL
-#define __USE_FORTIFY_LEVEL 99
+#if __GNUC_PREREQ (4,1)
+# undef	__USE_FORTIFY_LEVEL
+# define __USE_FORTIFY_LEVEL 99
+#endif
 
 /* Following here we need an #include for each public header file
    that uses __warndecl.  */

[-- Attachment #1.2: Type: application/pgp-signature, Size: 188 bytes --]

[-- Attachment #2.1: Type: text/plain, Size: 201 bytes --]


-- 
 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

[-- Attachment #2.2: Type: application/pgp-signature, Size: 188 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Warnings compiling debug/warning-nop
  2005-03-27 14:35 Warnings compiling debug/warning-nop Andreas Jaeger
@ 2005-03-27 20:03 ` Roland McGrath
  2005-03-27 20:07   ` Andreas Jaeger
  0 siblings, 1 reply; 7+ messages in thread
From: Roland McGrath @ 2005-03-27 20:03 UTC (permalink / raw)
  To: Andreas Jaeger; +Cc: Glibc hackers

> With GCC 4.0 I get these warnings compiling warning-nop.c:

That's the way the cookie crumbles.

> These functions do not exist with GCC 4.0.  I propose the appended
> patch which I've tested on i686-linux-gnu.  Ok to commit?

No.  That defeats the purpose of the file, which is to define symbols in
the ABI.  With your change, it will define nothing.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Warnings compiling debug/warning-nop
  2005-03-27 20:03 ` Roland McGrath
@ 2005-03-27 20:07   ` Andreas Jaeger
  2005-03-27 20:10     ` Roland McGrath
  0 siblings, 1 reply; 7+ messages in thread
From: Andreas Jaeger @ 2005-03-27 20:07 UTC (permalink / raw)
  To: Roland McGrath; +Cc: Glibc hackers

[-- Attachment #1: Type: text/plain, Size: 922 bytes --]

Roland McGrath <roland@frob.com> writes:

>> With GCC 4.0 I get these warnings compiling warning-nop.c:
>
> That's the way the cookie crumbles.
>
>> These functions do not exist with GCC 4.0.  I propose the appended
>> patch which I've tested on i686-linux-gnu.  Ok to commit?
>
> No.  That defeats the purpose of the file, which is to define symbols in
> the ABI.  With your change, it will define nothing.

I see.


I do not like to see such warnings on 64-bit systems and want to fix
the problem one way or the other:
../string/bits/string3.h:51: warning: return makes pointer from integer without a cast

What about adding proper prototypes for these functions for older GCC
versions?


Andreas
-- 
 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

[-- Attachment #2: Type: application/pgp-signature, Size: 188 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Warnings compiling debug/warning-nop
  2005-03-27 20:07   ` Andreas Jaeger
@ 2005-03-27 20:10     ` Roland McGrath
  2005-03-27 20:50       ` Andreas Jaeger
  0 siblings, 1 reply; 7+ messages in thread
From: Roland McGrath @ 2005-03-27 20:10 UTC (permalink / raw)
  To: Andreas Jaeger; +Cc: Glibc hackers

> 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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Warnings compiling debug/warning-nop
  2005-03-27 20:10     ` Roland McGrath
@ 2005-03-27 20:50       ` Andreas Jaeger
  2005-03-27 22:08         ` Roland McGrath
  0 siblings, 1 reply; 7+ messages in thread
From: Andreas Jaeger @ 2005-03-27 20:50 UTC (permalink / raw)
  To: Roland McGrath; +Cc: Glibc hackers

[-- Attachment #1: Type: text/plain, Size: 1687 bytes --]

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

[-- Attachment #2: Type: application/pgp-signature, Size: 188 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Warnings compiling debug/warning-nop
  2005-03-27 20:50       ` Andreas Jaeger
@ 2005-03-27 22:08         ` Roland McGrath
  2005-03-27 22:15           ` Andreas Jaeger
  0 siblings, 1 reply; 7+ messages in thread
From: Roland McGrath @ 2005-03-27 22:08 UTC (permalink / raw)
  To: Andreas Jaeger; +Cc: Glibc hackers

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

Seems fine.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Warnings compiling debug/warning-nop
  2005-03-27 22:08         ` Roland McGrath
@ 2005-03-27 22:15           ` Andreas Jaeger
  0 siblings, 0 replies; 7+ messages in thread
From: Andreas Jaeger @ 2005-03-27 22:15 UTC (permalink / raw)
  To: Roland McGrath; +Cc: Glibc hackers

[-- Attachment #1: Type: text/plain, Size: 957 bytes --]

Roland McGrath <roland@frob.com> writes:

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

Thanks - I'll commit tomorrow with the appended ChangeLog,

Andreas

2005-03-27  Andreas Jaeger  <aj@suse.de>

	* debug/warning-nop.c (__builtin___memcpy_chk): Define away to
	avoid warnings with older compiler.
	(__builtin___memcpy_chk): Likewise.
	(__builtin___memmove_chk: Likewise.
	(__builtin___mempcpy_chk): Likewise.
	(__builtin___memset_chk): Likewise.
	(__builtin___stpcpy_chk): Likewise.
	(__builtin___strcat_chk): Likewise.
	(__builtin___strcpy_chk): Likewise.
	(__builtin___strncat_chk): Likewise.
	(__builtin___strncpy_chk): Likewise.
	(__builtin_object_size): Likewise.

-- 
 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

[-- Attachment #2: Type: application/pgp-signature, Size: 188 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-03-27 22:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-27 14:35 Warnings compiling debug/warning-nop Andreas Jaeger
2005-03-27 20:03 ` Roland McGrath
2005-03-27 20:07   ` Andreas Jaeger
2005-03-27 20:10     ` Roland McGrath
2005-03-27 20:50       ` Andreas Jaeger
2005-03-27 22:08         ` Roland McGrath
2005-03-27 22:15           ` Andreas Jaeger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).