public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* fileops.c:1618: warning: weak declaration of `_IO_do_write' after first use results in unspecified behavior
@ 2002-08-23  1:48 Andreas Jaeger
  2002-08-23  2:46 ` Roland McGrath
  0 siblings, 1 reply; 6+ messages in thread
From: Andreas Jaeger @ 2002-08-23  1:48 UTC (permalink / raw)
  To: GNU libc hacker


We currently get a number of these warnings with GCC 3.3:
fileops.c:1618: warning: weak declaration of `_IO_do_write' after first use results in unspecified behavior
fileops.c:1621: warning: weak declaration of `_IO_file_finish' after first use results in unspecified behavior
fileops.c:1626: warning: weak declaration of `_IO_file_overflow' after first use results in unspecified behavior
fileops.c:1628: warning: weak declaration of `_IO_file_underflow' after first use results in unspecified behavior
fileops.c:1630: warning: weak declaration of `_IO_file_xsputn' after first use results in unspecified behavior

All of these have in fileops.c an INTDEF2:
INTDEF2(_IO_new_file_underflow, _IO_file_underflow)

hooks.c:84: warning: weak declaration of `__malloc_initialize_hook' after first use results in unspecified behavior
hooks.c:86: warning: weak declaration of `__free_hook' after first use results in unspecified behavior
hooks.c:88: warning: weak declaration of `__malloc_hook' after first use results in unspecified behavior
hooks.c:91: warning: weak declaration of `__realloc_hook' after first use results in unspecified behavior
hooks.c:94: warning: weak declaration of `__memalign_hook' after first use results in unspecified behavior

The variable is declared in malloc.h which is included by malloc.c and
that includes hooks.c.

What's the right fix for these?

- For hooks.c we could declare them in malloc.c before inclusion of
  malloc.h.
- For fileops.c I don't see directly a solution.

Andreas
-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj

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

* Re: fileops.c:1618: warning: weak declaration of `_IO_do_write' after first use results in unspecified behavior
  2002-08-23  1:48 fileops.c:1618: warning: weak declaration of `_IO_do_write' after first use results in unspecified behavior Andreas Jaeger
@ 2002-08-23  2:46 ` Roland McGrath
  2002-08-23  2:53   ` Andreas Jaeger
  2002-08-23  3:03   ` Andreas Jaeger
  0 siblings, 2 replies; 6+ messages in thread
From: Roland McGrath @ 2002-08-23  2:46 UTC (permalink / raw)
  To: Andreas Jaeger; +Cc: GNU libc hacker

Those warnings have been appearing for a while now (I also see them with
the RH variant of gcc-3.2), but I was too lazy to look into avoiding them
until you spurred me.  I was able to get rid of those warnings just by
reordering the decls in those files.  The weak decls don't need to appear
before any other decl of the symbol, only before any reference in a
function or another initializer.

Now the only spurious warnings in my build are "declared static but never
defined" for the things defined in asm and referenced via C decls.  I don't
know of any way to get rid of those.

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

* Re: fileops.c:1618: warning: weak declaration of `_IO_do_write' after first use results in unspecified behavior
  2002-08-23  2:46 ` Roland McGrath
@ 2002-08-23  2:53   ` Andreas Jaeger
  2002-08-23 11:01     ` Ulrich Drepper
  2002-08-23  3:03   ` Andreas Jaeger
  1 sibling, 1 reply; 6+ messages in thread
From: Andreas Jaeger @ 2002-08-23  2:53 UTC (permalink / raw)
  To: Roland McGrath; +Cc: GNU libc hacker

Roland McGrath <roland@redhat.com> writes:

> Those warnings have been appearing for a while now (I also see them with
> the RH variant of gcc-3.2), but I was too lazy to look into avoiding them
> until you spurred me.  I was able to get rid of those warnings just by
> reordering the decls in those files.  The weak decls don't need to appear
> before any other decl of the symbol, only before any reference in a
> function or another initializer.

Thanks a lot for fixing those!

>
> Now the only spurious warnings in my build are "declared static but never
> defined" for the things defined in asm and referenced via C decls.  I don't
> know of any way to get rid of those.

We had them for ages and I don't know whether it's possible to fix
those properly at all :-(

Andreas
-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj

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

* Re: fileops.c:1618: warning: weak declaration of `_IO_do_write' after first use results in unspecified behavior
  2002-08-23  2:46 ` Roland McGrath
  2002-08-23  2:53   ` Andreas Jaeger
@ 2002-08-23  3:03   ` Andreas Jaeger
  2002-08-23  3:53     ` Roland McGrath
  1 sibling, 1 reply; 6+ messages in thread
From: Andreas Jaeger @ 2002-08-23  3:03 UTC (permalink / raw)
  To: Roland McGrath; +Cc: GNU libc hacker

Roland McGrath <roland@redhat.com> writes:

> Those warnings have been appearing for a while now (I also see them with
> the RH variant of gcc-3.2), but I was too lazy to look into avoiding them
> until you spurred me.  I was able to get rid of those warnings just by
> reordering the decls in those files.  The weak decls don't need to appear
> before any other decl of the symbol, only before any reference in a
> function or another initializer.

I see now these warnings (at a different place!):
hooks.c:43: warning: weak declaration of `__malloc_initialize_hook' after first use results in unspecified behavior
hooks.c:45: warning: weak declaration of `__free_hook' after first use results in unspecified behavior
hooks.c:47: warning: weak declaration of `__malloc_hook' after first use results in unspecified behavior

The fileops warnings are gone,

Andreas
-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj

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

* Re: fileops.c:1618: warning: weak declaration of `_IO_do_write' after first use results in unspecified behavior
  2002-08-23  3:03   ` Andreas Jaeger
@ 2002-08-23  3:53     ` Roland McGrath
  0 siblings, 0 replies; 6+ messages in thread
From: Roland McGrath @ 2002-08-23  3:53 UTC (permalink / raw)
  To: Andreas Jaeger; +Cc: GNU libc hacker

> I see now these warnings (at a different place!):
> hooks.c:43: warning: weak declaration of `__malloc_initialize_hook' after first use results in unspecified behavior
> hooks.c:45: warning: weak declaration of `__free_hook' after first use results in unspecified behavior
> hooks.c:47: warning: weak declaration of `__malloc_hook' after first use results in unspecified behavior

Oddly enough, that bit in one build and not another for some reason.
With another round of reordering those are gone now too.

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

* Re: fileops.c:1618: warning: weak declaration of `_IO_do_write' after first use results in unspecified behavior
  2002-08-23  2:53   ` Andreas Jaeger
@ 2002-08-23 11:01     ` Ulrich Drepper
  0 siblings, 0 replies; 6+ messages in thread
From: Ulrich Drepper @ 2002-08-23 11:01 UTC (permalink / raw)
  To: Andreas Jaeger; +Cc: Roland McGrath, GNU libc hacker

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andreas Jaeger wrote:

>>Now the only spurious warnings in my build are "declared static but never
>>defined" for the things defined in asm and referenced via C decls.  I don't
>>know of any way to get rid of those.
> 
> 
> We had them for ages and I don't know whether it's possible to fix
> those properly at all :-(

It might be possible meanwhile to use attribute_hidden.  I.e., if 
attribute_hidden is available replace the static declaration with one 
declaring the functions as hidden.

- -- 
- ---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE9Znhk2ijCOnn/RHQRAmx/AJkBDf6GQXQeQgsq+W6ImzJie8njLgCgsY3h
+fwLBXATjRJcePAaTyhV/ic=
=uueI
-----END PGP SIGNATURE-----

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

end of thread, other threads:[~2002-08-23 18:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-23  1:48 fileops.c:1618: warning: weak declaration of `_IO_do_write' after first use results in unspecified behavior Andreas Jaeger
2002-08-23  2:46 ` Roland McGrath
2002-08-23  2:53   ` Andreas Jaeger
2002-08-23 11:01     ` Ulrich Drepper
2002-08-23  3:03   ` Andreas Jaeger
2002-08-23  3:53     ` Roland McGrath

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