This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: FATAL_EXIT_CODE - why 33?
>>>>> "Richard" == Richard Henderson <rth@redhat.com> writes:
Richard> I'd been thinking that it oughtn't necessarily be in a
Richard> main.c, but force each language to define main. I'd been
Richard> thinking that it would allow the elimination of some
Richard> other hook, but looking I don't immediately see which.
Richard> Perhaps nothing...
There are two basic directions:
- Create a series of hooks (function-pointers) that are called
whenever some non-standard behavior might be wanted.
(Note: we really want to use function-pointers, not
function-names, both to reduce interface clutter and
also to allow sharing of hooks.)
Let's call this the "Emacs approach", since Emacs works this
way.
The nice thing about this is that the algorithmic structure
remains in the main code; you just give these hooks a chance
to fire off every now and then.
That would argue for putting in a `lang_main' hook which is
called from `main'.
- Make a library out of GCC.
Essentially, create documented, self-contained interfaces
making GCC suitable for use as a component of a larger piece
of software.
I don't have a cute name for this approach, but it's the
GNOME/OLE approach.
This approach would argument for renaming main to `gcc_main',
and making it callable. Going one step further would be to make
it reentrant and thread-safe...
I'm not sure what to do here.
Sorry,
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com