Patch for %E formatting for C
Joseph S. Myers
jsm@polyomino.org.uk
Sun Oct 3 09:49:00 GMT 2004
On Sun, 2 Oct 2004, Gabriel Dos Reis wrote:
> that point C++ front-end would cease to pass plain IDENTIFIER_NODE
> around -- I expect it will wrap them in something that is an
> expression, otherwise the whole front-end will break :-).
> And I also expect that, at that point, th C front-end wouold improve too.
It has already improved in some places where identifiers could be confused
with other trees (for example, declarators now wrap the identifier in a
separate structure rather than having the IDENTIFIER_NODE itself represent
an identifier as a declarator). There is indeed plenty more to do.
> One could argue that the cases where the C front-end would need to
> pass IDENTIFIER_NODE to the pretty-printer should be inexistant, and
> it does then it contains a bug. If an IDENTIFIER_NODE is the name of
> a _DECL, then pass that decl, not the identifier.
There are many cases where %qs is presently used with IDENTIFIER_POINTER,
where there is an identifier that does not correspond to a DECL. For
example, all the instances of
warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
or the error
error ("label %qs referenced outside of any function",
IDENTIFIER_POINTER (name));
- so there is a clear use for %qI for such cases, while others should
become %qD, if a DECL can be identified (even if presently the name rather
than the DECL is being passed to the relevant function). At the same time
there is a clear use for %E for genuine expressions, and probably many C
front end diagnostics could be improved by its use.
--
Joseph S. Myers http://www.srcf.ucam.org/~jsm28/gcc/
http://www.srcf.ucam.org/~jsm28/gcc/#c90status - status of C90 for GCC 4.0
jsm@polyomino.org.uk (personal mail)
jsm28@gcc.gnu.org (Bugzilla assignments and CCs)
More information about the Gcc-patches
mailing list