[Bug pch/14130] New: #pragma once ignored with Precompiled header

tfautre at pandora dot be gcc-bugzilla@gcc.gnu.org
Thu Feb 12 15:44:00 GMT 2004


When not using PCH, GCC 3.4 seems to have fixed all the problems with #pragma once.
But with PCH, #pragma once seems broken again. The behavior would be best
described as if #pragma once is ignored and the header is included multiple times.

Note: #pragma once is used in headers included by the precompiled header. The
precompiled header itself uses a #ifndef-#define-#endif header guardian mechanism.

I've tested this on three different version of GCC (3.4 20040128, 3.4 20040211
and 3.5 20040113). All versions failed the test.

I'll try to attach the whole project to this bug report.
It contains:
 - a test project with 3 files: PchTest.cpp (main file), foobar.h (foobar class)
and stdafx.h (the precompiled header wanna be)
 - two makefiles, one without PCH, one with (don't forget to call "make clean"
when switching makefile)
 - full reports for the various GCC versions

-- 
           Summary: #pragma once ignored with Precompiled header
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: pch
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tfautre at pandora dot be
                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=14130



More information about the Gcc-bugs mailing list