Plan for removing global state from GCC's internals
David Malcolm
dmalcolm@redhat.com
Tue Jul 2 15:26:00 GMT 2013
On Mon, 2013-07-01 at 19:43 +0000, Joseph S. Myers wrote:
> On Mon, 1 Jul 2013, David Malcolm wrote:
[...]
> > Would you be in favor killing off these macros:
> > #define input_line LOCATION_LINE (input_location)
> > #define input_filename LOCATION_FILE (input_location)
> > #define in_system_header (in_system_header_at (input_location))
> > with patches that make the usage of "input_location" explicit? (by
> > replacing all uses of these macros with their expansions, cleaning up
> > line-wraps as needed).
>
> Yes.
>
> > The only other macro that implicitly uses input_location is
> > EXPR_LOC_OR_HERE; that could be removed in favor of:
> > EXPR_LOC_OR_LOC(expr, input_location)
> > again making input_location explicit.
>
> (I suspect then eliminating the input_location from this - ensuring all
> expressions have meaningful locations so EXPR_LOC_OR_LOC isn't needed at
> all - will depend on Andrew MacLeod's proposal. It doesn't explicitly
> mention this, but one thing that would be desirable as part of making
> front ends generate internal representation closer to the source would be
> explicitly representing locations for constants, and for references to
> declarations within expressions, so that everywhere that wants a location
> for an expression can reliably extract one from it rather than finding
> there is no location because certain expressions are shared.)
Thanks.
I've posted a patch for review that removes these macros:
http://gcc.gnu.org/ml/gcc-patches/2013-07/msg00072.html
More information about the Gcc
mailing list