Target macros vs. target hooks - policy/goal is hooks, isn't it?

Michael Meissner meissner@linux.vnet.ibm.com
Wed May 26 18:03:00 GMT 2010


On Wed, May 26, 2010 at 10:16:22AM -0700, Mark Mitchell wrote:
> Ulrich Weigand wrote:
> 
> >> So the question is: The goal is to have hooks, not macros, right? If
> >> so, can reviewers please take care to reject patches that introduce
> >> new macros?
> > 
> > I don't know to which extent this is a formal goal these days, but I
> > personally agree that it would be nice to eliminate macros.
> 
> Yes, the (informally agreed) policy is to have hooks, not macros.  There
> may be situations where that is technically impossible, but I'd expect
> those to be very rare.

For the target address space stuff, it is to the __ea keyword.  You don't want
a target hook that is called on every identifier, but instead you want a target
hook that is called in c_parse_init (in c-parser.c) and init_reswords (in
cp/lex.c) to set up the keywords.  The target hook would have to duplicate the
functionality of all of the setup that c_parse_init and init_reswords do,
particularly if they have different semantics.

-- 
Michael Meissner, IBM
Until June 14: 4 Technology Place Drive, MS 2203A, Westford, MA, 01886, USA
After June 14: 5 Technology Place Drive, MS 2757, Westford, MA 01886, USA
meissner@linux.vnet.ibm.com



More information about the Gcc mailing list