This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: Better MAIN_NAME_P for all C-ish front-ends
>>>>> "Greg" == Greg McGary <greg@mcgary.org> writes:
Greg> OK. Why don't we just skip my current patch and go to
Greg> something that's more correct. It sounds as though we also
Your patch *is* correct -- it's just not the whole story. I think we
still want it -- there are places that we need to check whether the
name is `main' without the declaration.
Greg> want a new macro MAIN_DECL_P(DECL) that tests for
I thought about this -- the C++ front-end has DECL_MAIN_P.
Greg> MAIN_NAME_P and that DECL is global and a FUNCTION_DECL
Greg> node. That should suffice, no?
Perhaps.
I'd prefer to let front-ends set this bit as they see fit, though.
For example, in some languages, the main function might be called
`start'. The DECL_ASSEMBLER_NAME for such a function might be `main'
to allow the C start-up code to work, but DECL_NAME might not be
`main'.
I'd sugget we apply your patch, and then think about how to solve this
best.
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com