The --combine option fails to forget the "once" property of a header file when gcc moves on to dealing with the next *.c file. The pragma should function just the same as the usual "#ifndef _SOME_ARBITRARY_CRAP" hack.
k 0 $ cat once.h #pragma once #define D k 0 $ cat a.c #include "once.h" #ifndef D #error No def in a.c! #endif k 0 $ cat b.c #include "once.h" #ifndef D #error No def in b.c! #endif k 0 $ gcc --combine a.c b.c b.c:3:2: error: #error No def in b.c! k 1 $ gcc -v Using built-in specs. Target: x86_64-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=x86_64-redhat-linux Thread model: posix gcc version 4.1.1 20060828 (Red Hat 4.1.1-20) k 0 $ -- Summary: --combine can't handle #pragma once Product: gcc Version: 4.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: acahalan at gmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29172