simple test.c test.h files compile without using pch and generate strange warning if use test.h.gch All case with options: g++ -ansi -pedantic -Werror -Winvalid-pch -test.h----8<----------- #include<string> -test.h---->8----------- -test.cc---8<----------- #include"test.h" int main() { return 0; } -test.cc--->8----------- Warning generated at line in concept_check.h:52 : #define __glibcpp_function_requires(...) Release: 3.4 20030423 (experimental) Environment: FreeBSD 4.7-RELEASE-p9
From: Phil Edwards <phil@jaj.com> To: wanderer@rsu.ru Cc: gcc-gnats@gcc.gnu.org, and@rsu.ru Subject: Re: c++/10470: anonymous variadic macros were introduced in C99 warning at pch using Date: Wed, 23 Apr 2003 22:26:49 -0400 On Wed, Apr 23, 2003 at 09:45:39PM -0000, wanderer@rsu.ru wrote: > >Description: > simple test.c test.h files compile without using pch > and generate strange warning if use test.h.gch > > All case with options: g++ -ansi -pedantic -Werror -Winvalid-pch > > -test.h----8<----------- > #include<string> > -test.h---->8----------- > > -test.cc---8<----------- > #include"test.h" > > int main() { > return 0; > } > -test.cc--->8----------- > > Warning generated at line in concept_check.h:52 : > > #define __glibcpp_function_requires(...) That code isn't going to change anytime soon; see the comment preceeding it. That header is marked with system_header. It shouldn't be generating these warnings, even in PCH mode... -- If ye love wealth greater than liberty, the tranquility of servitude greater than the animating contest for freedom, go home and leave us in peace. We seek not your counsel, nor your arms. Crouch down and lick the hand that feeds you; and may posterity forget that ye were our countrymen. - Samuel Adams
Responsible-Changed-From-To: unassigned->geoffk Responsible-Changed-Why: pch
State-Changed-From-To: open->analyzed State-Changed-Why: Geoff, I think you're being overly harsh -- the bug report includes everything one needs to reproduce the problem. I see the very same reported problem on my linux box. It should be simple for you as well to reproduce this. W. g/x> cat x.h #include<string> g/x> cat x.cc #include"x.h" int main() { return 0; } g/x> rm x.h.gch rm: cannot remove `x.h.gch': No such file or directory g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -ansi -pedantic -Werror -Winvalid-pch -c x.cc g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -ansi -pedantic -Werror -Winvalid-pch -c x.h g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -ansi -pedantic -Werror -Winvalid-pch -c x.cc x.cc:679:2: anonymous variadic macros were introduced in C99 Note also the bogus line number 679, which certainly doesn't exist in this file.
From: "Vladimir Merzliakov" <wanderer@rsu.ru> To: <gcc-gnats@gcc.gnu.org>, <and@rsu.ru>, <geoffk@gcc.gnu.org>, <gcc-bugs@gcc.gnu.org>, <gcc-prs@gcc.gnu.org>, "Vladimir Merzliakov" <wanderer@rsu.ru> Cc: Subject: Re: c++/10470: [pch] spurious warning about "anonymous variadic macros were introduced in C99" Date: Mon, 28 Apr 2003 16:31:52 +0400 I prepare more simple testcase (now it not use any GCC headers) Sorry, i can't provide test.ii file (in this case bug isn't catched and test.cc compile fine with and without using PCH) Needed files: -testsys.h----8<-------- #pragma GCC system_header #define __glibcpp_function_requires(...) -testsys.h---->8-------- -test.h----8<----------- #include"testsys.h" -test.h---->8----------- -test.cc---8<----------- #include"test.h" -test.cc--->8----------- Script: -t---8<----------- #!/bin/sh - rm *.gch echo !!! Compile without gch g++ -ansi -Werror -pedantic -Winvalid-pch -o test.o -c test.cc echo !!! GCH generation g++ -ansi -Werror -pedantic -Winvalid-pch -o test.h.gch -c test.h echo !!! Compile with gch g++ -ansi -Werror -pedantic -Winvalid-pch -o test.o -c test.cc -t--->8----------- generate output: ----8<----------- !!! Compile without gch !!! GCH generation !!! Compile with gch test.cc:42:2: anonymous variadic macros were introduced in C99 ---->8----------- GCC in PCH mode don't remember "#pragma GCC system_header" in testsys.h Also error location (test.cc:42:2) is invalid. I use for testing gcc version 3.4 20030428 (experimental) at FreeBSD 4.7-RELEASE-p9 . Vladimir http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10470
From: Wolfgang Bangerth <bangerth@ices.utexas.edu> To: gcc-gnats@gcc.gnu.org Cc: Subject: Re: c++/10470: [pch]... Date: Thu, 1 May 2003 18:07:11 -0500 (CDT) Just in case this of any help: if I compile more than one .cc file that includes the same precompiled header, I always get the spurious warning at the same line number and column: =====base=============debug========== function_lib.cc source/function_lib.cc:3510:2: warning: anonymous variadic macros were introduced in C99 =====base=============debug========== function_lib_cutoff.cc source/function_lib_cutoff.cc:3510:2: warning: anonymous variadic macros were introduced in C99 =====base=============debug========== function_time.cc source/function_time.cc:3510:2: warning: anonymous variadic macros were introduced in C99 =====base=============debug========== job_identifier.cc source/job_identifier.cc:3510:2: warning: anonymous variadic macros were introduced in C99 =====base=============debug========== log.cc source/log.cc:3510:2: warning: anonymous variadic macros were introduced in C99 W. ------------------------------------------------------------------------- Wolfgang Bangerth email: bangerth@ices.utexas.edu www: http://www.ices.utexas.edu/~bangerth/
It does warn in Apple's 3.3 based gcc (build 1409) with PCH in it.
This is fixed by this change which I just committed to HEAD: Index: gcc/ChangeLog 2004-06-09 Geoffrey Keating <geoffk@apple.com> * Makefile.in (CPPLIB_H): Put files in order of inclusion. (CPP_ID_DATA_H): New. (gtype-desc.o): Update dependencies. (GTFILES): Use CPP_ID_DATA_H. Index: gcc/testsuite/ChangeLog 2004-06-09 Geoffrey Keating <geoffk@apple.com> * gcc.dg/pch/macro-4.c: New. * gcc.dg/pch/macro-4.hs: New. Index: libcpp/ChangeLog 2004-06-09 Geoffrey Keating <geoffk@apple.com> * traditional.c (push_replacement_text): Set macro->traditional. (save_replacement_text): Likewise. * pch.c (cpp_write_pch_state): Don't write list of defined macros. (struct save_macro_item): Delete. (struct save_macro_data): Use a character array not the previous structured format. (save_macros): Save macro as text not as internal structures. (cpp_prepare_state): Update for changes to save_macro_data. (cpp_read_state): Don't read macros defined in PCH. Restore -D macros as text. * macro.c (create_iso_definition): Honour alloc_subobject. Clear traditional flag. (_cpp_create_definition): Honour alloc_subobject. * lex.c (cpp_token_val_index): New. * internal.h: Include cpp-id-data.h. (uchar): Move definition to cpp-id-data.h. (U): Likewise. (cpp_macro): Likewise. * directives.c (struct answer): Move to cpp-id-data.h. (do_assert): Honour alloc_subobject. Index: libcpp/include/ChangeLog 2004-06-09 Geoffrey Keating <geoffk@apple.com> * symtab.h (struct ht): Add field 'alloc_subobject'. * cpplib.h (struct cpp_string): Add GTY marker. (enum cpp_token_fld_kind): New. (struct cpp_token): Add GTY markers. (cpp_token_val_index): Prototype. (CPP_HASHNODE_VALUE_IDX): New. (struct cpp_hashnode): Don't skip fields of 'value' when marking. * cpp-id-data.h: New file.