public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug pch/17162] New: warning about invalid precompiled header even if the correct one is used
@ 2004-08-24  2:02 rodolfo at rodsoft dot org
  2004-08-24  2:05 ` [Bug pch/17162] " rodolfo at rodsoft dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: rodolfo at rodsoft dot org @ 2004-08-24  2:02 UTC (permalink / raw)
  To: gcc-bugs

When using precompiled headers (pch for short) in a way where I can have 
several versions of the same header precompiled with different compiler options
(all pch:s in directory (pch.h.gch for instance), and if I'm using -Winvalid-pch, 
gcc emits a warning for every invalid pch found in the directory
until it gets the right one. It gets pretty annoying when using -Werror. This
shouldn't happen because it finds the correct pch. The warning should be 
shown if gcc doesn't find a valid precompiled header at all.
Here's a test case:

/* test.c */
#include "pch.h"
int main() { return 0; }

/* pch.h empty */

/* Makefile */
all: test1 test2

clean:
        rm -rf *.o test1 test2 pch.h.gch

test1: test.c pch.h.gch/pch.pic
        gcc -H -Winvalid-pch -fpic -o $@ $<
        
test2: test.c pch.h.gch/pch.nonpic
        gcc -H -Winvalid-pch  -o $@ $<

pch.h.gch/pch.pic: pch.h
        mkdir -p pch.h.gch
        gcc -fpic -o $@ $<
        
pch.h.gch/pch.nonpic: pch.h
        mkdir -p pch.h.gch
        gcc -o $@ $<

/* END OF TESTCASE */

When running make, the following is output:

mkdir -p pch.h.gch
gcc -fpic -o pch.h.gch/pch.pic pch.h
gcc -H -Winvalid-pch -fpic -o test1 test.c
! pch.h.gch/pch.pic
mkdir -p pch.h.gch
gcc -o pch.h.gch/pch.nonpic pch.h
gcc -H -Winvalid-pch  -o test2 test.c
test.c:1:17: warning: pch.h.gch/pch.pic: created and used with different settings of -fpic
x pch.h.gch/pch.pic
! pch.h.gch/pch.nonpic

-- 
           Summary: warning about invalid precompiled header even if the
                    correct one is used
           Product: gcc
           Version: 3.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: pch
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rodolfo at rodsoft dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17162


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

* [Bug pch/17162] warning about invalid precompiled header even if the correct one is used
  2004-08-24  2:02 [Bug pch/17162] New: warning about invalid precompiled header even if the correct one is used rodolfo at rodsoft dot org
@ 2004-08-24  2:05 ` rodolfo at rodsoft dot org
  2004-08-30 21:28 ` geoffk at gcc dot gnu dot org
  2004-08-31  1:04 ` rodolfo at rodsoft dot org
  2 siblings, 0 replies; 4+ messages in thread
From: rodolfo at rodsoft dot org @ 2004-08-24  2:05 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rodolfo at rodsoft dot org  2004-08-24 02:05 -------
I just forgot to add gcc -v in my report, sorry.

[rodolfo@home ~/src/tstpch/tst]$ gcc -v   
Reading specs from /usr/lib/gcc/i686-pc-linux-gnu/3.4.1/specs
Configured with: ../gcc-3.4.1/configure --prefix=/usr --libexecdir=/usr/lib 
--enable-shared --enable-threads=posix --enable-__cxa_atexit 
--enable-clocale=gnu --enable-languages=c,c++
Thread model: posix
gcc version 3.4.1

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17162


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

* [Bug pch/17162] warning about invalid precompiled header even if the correct one is used
  2004-08-24  2:02 [Bug pch/17162] New: warning about invalid precompiled header even if the correct one is used rodolfo at rodsoft dot org
  2004-08-24  2:05 ` [Bug pch/17162] " rodolfo at rodsoft dot org
@ 2004-08-30 21:28 ` geoffk at gcc dot gnu dot org
  2004-08-31  1:04 ` rodolfo at rodsoft dot org
  2 siblings, 0 replies; 4+ messages in thread
From: geoffk at gcc dot gnu dot org @ 2004-08-30 21:28 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From geoffk at gcc dot gnu dot org  2004-08-30 21:28 -------
The compiler doesn't know that it found the "right" PCH.  It might have found the wrong one.  
-Winvalid-pch should not be used in combination with -Werror in circumstances where a PCH might be 
rejected.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17162


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

* [Bug pch/17162] warning about invalid precompiled header even if the correct one is used
  2004-08-24  2:02 [Bug pch/17162] New: warning about invalid precompiled header even if the correct one is used rodolfo at rodsoft dot org
  2004-08-24  2:05 ` [Bug pch/17162] " rodolfo at rodsoft dot org
  2004-08-30 21:28 ` geoffk at gcc dot gnu dot org
@ 2004-08-31  1:04 ` rodolfo at rodsoft dot org
  2 siblings, 0 replies; 4+ messages in thread
From: rodolfo at rodsoft dot org @ 2004-08-31  1:04 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rodolfo at rodsoft dot org  2004-08-31 01:04 -------
I know it might have found the wrong one, but it should print the warning after
having tried all pch's in the directory. Or better, it should warn if he gave up
trying to use a pch and parsed the header itself. This way seems logical to me,
because if I generated the pch, I want it to use them, and I want to be warned if
it isn't working the way I've espected. In my example I generate 2 pch's with
different configs, and the compiler should pick the right one without
complaining. But if all pch's are invalid, print the warning. I still think is a
bug...

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17162


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

end of thread, other threads:[~2004-08-31  1:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-24  2:02 [Bug pch/17162] New: warning about invalid precompiled header even if the correct one is used rodolfo at rodsoft dot org
2004-08-24  2:05 ` [Bug pch/17162] " rodolfo at rodsoft dot org
2004-08-30 21:28 ` geoffk at gcc dot gnu dot org
2004-08-31  1:04 ` rodolfo at rodsoft dot org

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