[Bug preprocessor/58770] GCC very slow compiling with #pragma once

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jul 7 10:44:00 GMT 2014


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

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Manuel López-Ibáñez from comment #4)
> Sorry, I don't understand this. The #ifdef include-guards do prevent a
> second inclusion, even if done by a different file name, no?

No, including the file via a different filename (e.g. via a symlink) will
re-open the file and preprocess it again. The include guards mean you don't get
re-definition of the file contents, but the file still gets included twice. You
can confirm that with strace.

With #pragma once the file is not even re-opened, so the compiler needs to do
extra checking.


More information about the Gcc-bugs mailing list