This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Best way to remove cpp0
- To: Zack Weinberg <zack at codesourcery dot com>, joseph at daikokuya dot demon dot co dot uk
- Subject: Best way to remove cpp0
- From: Neil Booth <neil at daikokuya dot demon dot co dot uk>
- Date: Fri, 12 Oct 2001 22:35:09 +0100
- Cc: gcc at gcc dot gnu dot org
I'm considering (gradually) moving the functionality of cppmain.c into
the main library, and then dropping cpp0. Then cc1 or cc1plus etc.
would contian the only preprocessor, including the stand-alone case.
The cc1 binary could then act in three states:
1) Stand-alone preprocessor (invoked with "cpp")
2) Compiler-integrated preprocessor ("gcc", "g++" etc.)
3) Both (something like "gcc -save-temps")
This would remove a few issues with the existing codebase, and allow
for more efficient preprocessed output, since that code can be part of
cpplib without destroying encapsulation. We could also simplify some
nasty specs in gcc.c, I imagine.
But how does 3) work? It's easy to insert in a location, outside
cpp_get_token(), at the level of what is currently c_lex() but would
probably become part of cpplib, something like
token = cpp_get_token (pfile);
if (pfile->preprocessed_output_p)
output_token (pfile, token);
to simultaneously generate preprocessed output, and have hooks to do
the line markers like we do now in cppmain.c. This is what I'm
leaning towards. 1) would be a separate function that is similar to
the current scan_translation_unit() in cppmain.c, just getting tokens
and outputting them.
However, if there's a bug in the compiler during 2), say a segfault,
then the preprocessed output with -save-temps would only proceed as
far as the compiler bug. We have asked users to submit the
preprocessed output obtained with -save-temps.
What's the best way forwards for this case?
Neil.