[Bug preprocessor/66246] New: PCH breaks preprocessor

2015-05-21 Thread kai-bugs at cats dot ms
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66246

Bug ID: 66246
   Summary: PCH breaks preprocessor
   Product: gcc
   Version: 4.9.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: preprocessor
  Assignee: unassigned at gcc dot gnu.org
  Reporter: kai-bugs at cats dot ms
  Target Milestone: ---

Created attachment 35590
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35590&action=edit
Header

Test consists of:
- make sure we have no PCH
- compile the source w/o PCH
- compile the PCH
- compile the source w/PCH

As far as I can tell, the reason for the problems is that macros no longer get
expanded

If it matters, this is from the MinGW packaged with Qt 5.4.

$ cat t.sh
#! /bin/bash -x

gcc --version
rm th.hh.gch
g++ -Winvalid-pch -c -save-temps test.cc
g++ -x c++-header -c -save-temps th.hh
g++ -Winvalid-pch -c -save-temps test.cc

$ ./t.sh
+ gcc --version
gcc.exe (i686-posix-dwarf-rev2, Built by MinGW-W64 project) 4.9.1
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

+ rm th.hh.gch
+ g++ -Winvalid-pch -c -save-temps test.cc
+ g++ -x c++-header -c -save-temps th.hh
+ g++ -Winvalid-pch -c -save-temps test.cc
In file included from
C:/Qt/Tools/mingw491_32/i686-w64-mingw32/include/_mingw.h:13:0,
 from
C:/Qt/Tools/mingw491_32/i686-w64-mingw32/include/crtdefs.h:10,
 from
C:/Qt/Tools/mingw491_32/i686-w64-mingw32/include/assert.h:15,
 from test.cc:4:
C:/Qt/Tools/mingw491_32/i686-w64-mingw32/include/_mingw_secapi.h:51:10: error:
redefinition of 'struct __if_array'
   struct __if_array  {
  ^
In file included from
C:/Qt/Tools/mingw491_32/i686-w64-mingw32/include/_mingw.h:13:0,
 from
C:/Qt/Tools/mingw491_32/i686-w64-mingw32/include/crtdefs.h:10,
 from
C:/Qt/Tools/mingw491_32/i686-w64-mingw32/include/assert.h:15,
 from th.hh:1:
C:/Qt/Tools/mingw491_32/i686-w64-mingw32/include/_mingw_secapi.h:51:10: error:
previous definition of 'struct __if_array'
   struct __if_array  {
  ^
In file included from
C:/Qt/Tools/mingw491_32/i686-w64-mingw32/include/crtdefs.h:10:0,
 from
C:/Qt/Tools/mingw491_32/i686-w64-mingw32/include/assert.h:15,
 from test.cc:4:
C:/Qt/Tools/mingw491_32/i686-w64-mingw32/include/_mingw.h: In function 'void
__debugbreak()':
C:/Qt/Tools/mingw491_32/i686-w64-mingw32/include/_mingw.h:657:101: error:
redefinition of 'void __debugbreak()'
 __MINGW_INTRIN_INLINE void __cdecl __debugbreak(void)
   
 ^
In file included from
C:/Qt/Tools/mingw491_32/i686-w64-mingw32/include/crtdefs.h:10:0,
 from
C:/Qt/Tools/mingw491_32/i686-w64-mingw32/include/assert.h:15,
 from th.hh:1:
C:/Qt/Tools/mingw491_32/i686-w64-mingw32/include/_mingw.h:657:101: note: 'void
__debugbreak()' previously defined here
 __MINGW_INTRIN_INLINE void __cdecl __debugbreak(void)
   
 ^
In file included from
C:/Qt/Tools/mingw491_32/i686-w64-mingw32/include/assert.h:15:0,
 from test.cc:4:
C:/Qt/Tools/mingw491_32/i686-w64-mingw32/include/crtdefs.h: At global scope:
C:/Qt/Tools/mingw491_32/i686-w64-mingw32/include/crtdefs.h:159:16: error:
redefinition of 'struct localeinfo_struct'
 typedef struct localeinfo_struct {
^
In file included from
C:/Qt/Tools/mingw491_32/i686-w64-mingw32/include/assert.h:15:0,
 from th.hh:1:
C:/Qt/Tools/mingw491_32/i686-w64-mingw32/include/crtdefs.h:159:16: error:
previous definition of 'struct localeinfo_struct'
 typedef struct localeinfo_struct {
^
In file included from
C:/Qt/Tools/mingw491_32/i686-w64-mingw32/include/assert.h:15:0,
 from test.cc:4:
C:/Qt/Tools/mingw491_32/i686-w64-mingw32/include/crtdefs.h:162:18: error:
invalid type in declaration before ',' token
 } _locale_tstruct,*_locale_t;
  ^
C:/Qt/Tools/mingw491_32/i686-w64-mingw32/include/crtdefs.h:162:18: error:
conflicting declaration 'typedef int _locale_tstruct'
In file included from
C:/Qt/Tools/mingw491_32/i686-w64-mingw32/include/assert.h:15:0,
 from th.hh:1:
C:/Qt/Tools/mingw491_32/i686-w64-mingw32/include/crtdefs.h:162:3: note:
previous declaration as 'typedef struct localeinfo_struct _locale_tstruct'
 } _locale_tstruct,*_locale_t;
   ^
In file included from
C:/Qt/Tools/mingw491_32/i686-w64-mingw32/include/assert.h:15:0,
 from test.cc:4:
C:/Qt/Tools/mingw491_32/i686-w64-mingw32/include/crtdefs.h:162:20: erro

[Bug preprocessor/66246] PCH breaks preprocessor

2015-05-21 Thread kai-bugs at cats dot ms
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66246

--- Comment #1 from kai-bugs at cats dot ms ---
Created attachment 35591
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35591&action=edit
Source


[Bug preprocessor/66246] PCH breaks preprocessor

2015-05-26 Thread kai-bugs at cats dot ms
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66246

kai-bugs at cats dot ms changed:

   What|Removed |Added

 Target|i686-w64-mingw32|i686-w64-mingw32
   ||x86_64-linux-gnu
   Host|i686-w64-mingw32|i686-w64-mingw32
   ||x86_64-linux-gnu
  Known to fail||4.6.3, 4.9.1
  Build|i686-w64-mingw32|i686-w64-mingw32
   ||x86_64-linux-gnu

--- Comment #2 from kai-bugs at cats dot ms ---
Here's another version that breaks:

+ gcc --version
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Copyright (C) 2011 Free Software Foundation, Inc.
Dies ist freie Software; die Kopierbedingungen stehen in den Quellen. Es
gibt KEINE Garantie; auch nicht für MARKTGÄNGIGKEIT oder FÜR SPEZIELLE ZWECKE.

+ rm th.hh.gch
+ g++ -Winvalid-pch -c -save-temps test.cc
+ g++ -x c++-header -c -save-temps th.hh
+ g++ -Winvalid-pch -c -save-temps test.cc
test.cc: In Funktion »void f()«:
test.cc:14:8: Fehler: »__FILE__« wurde in diesem Gültigkeitsbereich nicht
definiert
test.cc:14:18: Fehler: »__LINE__« wurde in diesem Gültigkeitsbereich nicht
definiert