public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Best way to remove cpp0
@ 2001-10-12 14:35 Neil Booth
  2001-10-12 14:44 ` Daniel Jacobowitz
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Neil Booth @ 2001-10-12 14:35 UTC (permalink / raw)
  To: Zack Weinberg, joseph; +Cc: gcc

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.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2001-10-15  1:18 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-12 14:35 Best way to remove cpp0 Neil Booth
2001-10-12 14:44 ` Daniel Jacobowitz
2001-10-12 15:24   ` Neil Booth
2001-10-12 14:48 ` Joseph S. Myers
2001-10-12 15:01 ` Stan Shebs
2001-10-12 15:19   ` Neil Booth
2001-10-14 17:45 ` Joern Rennecke
2001-10-14 23:41   ` Neil Booth
2001-10-15  1:18     ` Joern Rennecke

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).