On Aug 13, 2008, at 12:16 PM, Joseph S. Myers wrote:
On Wed, 13 Aug 2008, Aldy Hernandez wrote:
It seems to me that the only approach here would be to provide caret
diagnostics, because reconstructing the original sources from GENERIC
seems like a loosing proposition.
In some cases the only useful place to find the expression is in the
preprocessed sources, not the original sources, so you want to be
able to
print an expression extracted from those not just one extracted from
pointers into the original sources. But in either case extracting an
expressions using some form of beginning and ending locations would
give
better results than reconstructing a representation of the
expression from
trees.
I agree, this is the best way to go. Clang produces:
$ clang t.c
t.c:4:15: error: called object is not a function or function pointer
({ int i; })();
~~~~~~~~~~~~^
t.c:13:9: error: called object is not a function or function pointer
((B)a)();
~~~~~~^
t.c:17:10: error: called object is not a function or function pointer
(p - q)();
~~~~~~~^
t.c:18:18: error: called object is not a function or function pointer
(p < q ? p : q)();
~~~~~~~~~~~~~~~^
4 diagnostics generated.
Which scales well to other arbitrary expressions.
-Chris