[Bug preprocessor/108101] New: "#pragma once" causes other files not be included

terra at gnome dot org gcc-bugzilla@gcc.gnu.org
Wed Dec 14 13:12:49 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108101

            Bug ID: 108101
           Summary: "#pragma once" causes other files not be included
           Product: gcc
           Version: 12.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: terra at gnome dot org
  Target Milestone: ---

# (echo '#pragma once'; echo 'Killroy was here') > a.h
# (echo '#pragma once'; echo 'Killroy was here') > b.h
# (echo '#include "a.h"'; echo '#include "b.h"') > c.c
# gcc -E c.c | grep Killroy
1
# clang -E c.c | grep Killroy
2

According to gcc, Killroy was only there once.  Clang is keeping better track
and spots him there twice.

This seems to be version independent: tried 7.5.0 and 12.1.0


More information about the Gcc-bugs mailing list