This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: 20000131 anomolous system header warnings
- To: RodneyBrown at pmsc dot com, RDBrown at mira dot net
- Subject: Re: 20000131 anomolous system header warnings
- From: Zack Weinberg <zack at wolery dot cumb dot org>
- Date: Fri, 4 Feb 2000 09:26:33 -0800
- Cc: gcc-bugs at gcc dot gnu dot org, RobertLipe at usa dot net
- References: <200002041134.WAA00431@ppp15.dyn138.pacific.net.au>
On Fri, Feb 04, 2000 at 10:33:59PM +1100, Rodney Brown wrote:
> The egcs-20000131 snapshot on i586-sco-sysv5uw7.1.0 gave lots of anomalous
> "defined but not used" warnings on include/sys/stat.h for {f,,l}stat.
> These are static wrapper functions on UnixWare.
>
> Debugging, it seems that the 2nd and subsequent static functions defined
> in a system header file trigger the warnings.
>
> ./cc1 tmp6.i -quiet -Wall -version -fpreprocessed
>
> with the enclosed tmp6.i, will demonstrate the problem on all platforms
> (verified on hppa2.0-hp-hpux10.20).
>
> As mentioned in my email to Robert Lipe - who picked this up,
> further debugging shows the in_system_header global as 1 and the
> failure to set the in_system_header field of the tree for the functions
> was caused by current_obstack != &permanent_obstack .
[...]
Try this. It fixes the problem for me with your example, but may not
be the right answer in general - there must have been some reason why
we made a distinction between permanent and temporary decls here.
zw
===================================================================
Index: tree.c
--- tree.c 2000/01/17 15:55:18 1.115
+++ tree.c 2000/02/04 17:25:16
@@ -1061,7 +1061,7 @@ make_node (code)
if (code != FUNCTION_DECL)
DECL_ALIGN (t) = 1;
DECL_IN_SYSTEM_HEADER (t)
- = in_system_header && (obstack == &permanent_obstack);
+ = in_system_header && (ggc_p || obstack == &permanent_obstack);
DECL_SOURCE_LINE (t) = lineno;
DECL_SOURCE_FILE (t) =
(input_filename) ? input_filename : built_in_filename;