This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
libstdc++ headers and system headers
- To: gcc at gcc dot gnu dot org, libstdc++ at gcc dot gnu dot org
- Subject: libstdc++ headers and system headers
- From: Neil Booth <neil at daikokuya dot demon dot co dot uk>
- Date: Thu, 15 Feb 2001 23:45:31 +0000
- Cc: Jason Merrill <jason at redhat dot com>
Compiling a file containing merely
#include <iostream.h>
with
g++ -E test.c -o test.ii -I /usr/local/include/g++-v3/
and then re-compiling the preprocessed file gives a bunch of warnings
about header flags changing. I've just realized why: various headers
in the bits/ directory have
#pragma GCC system_header
in them. Since the command line has "-I", the directories are not
considered system directories, so the preprocessed output has no "3"
flag when entering the file, but when returning to the file from a nested
include, it has since become a system header owing to the pragma and the
"3" flag magically appears. CPP complains when re-preprocessing and
the flags don't match.
I don't know why libstdc++ uses the pragma, but that's another issue.
The bug is that CPP is not creating a file_change callback for #pragma,
but I think it should do (like it would for #include or for #line).
This callback would then result in the correct flags output, and the
warnings would disappear. It would also have the benefit that the front
ends know about #pragma system_header; at present they are not informed
of the change in state.
Do you agree this is the correct fix, Jason?
Neil.