Bug 10470 - spurious warning about "anonymous variadic macros were introduced in C99"
Summary: spurious warning about "anonymous variadic macros were introduced in C99"
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: pch (show other bugs)
Version: 3.4.0
: P3 normal
Target Milestone: 4.0.0
Assignee: Geoff Keating
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2003-04-23 21:46 UTC by wanderer
Modified: 2004-07-10 00:54 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2003-11-18 07:42:50


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description wanderer 2003-04-23 21:46:01 UTC
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
Comment 1 phil 2003-04-23 22:26:49 UTC
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

Comment 2 Wolfgang Bangerth 2003-04-24 01:33:56 UTC
Responsible-Changed-From-To: unassigned->geoffk
Responsible-Changed-Why: pch
Comment 3 Wolfgang Bangerth 2003-04-24 01:33:56 UTC
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.
Comment 4 wanderer 2003-04-28 16:31:52 UTC
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
 
 

Comment 5 Wolfgang Bangerth 2003-05-01 18:07:11 UTC
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/
Comment 6 Andrew Pinski 2003-08-04 04:08:22 UTC
It does warn in Apple's 3.3 based gcc (build 1409) with PCH in it.
Comment 7 Geoff Keating 2004-06-09 20:15:15 UTC
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.