------- Comment #3 from manu at gcc dot gnu dot org  2008-08-11 12:32 -------
(In reply to comment #2)
> void  
> foo ()
> {
> #define WARNS while(0)
> #define DOES_NOT_WARN while(0); 
>         WARNS; // { dg-warning }
>         DOES_NOT_WARN;

I don't think we want to warn here. Even if we have the right location of ')',
this would be hard to warn. How do you distinguish?

DOES_NOT_WARN;
DOES_NOT_WARN/**/;

That said, I don't think tracking the end of the macro is a good idea either.
It just moves the problem around. Another workaround would be to not check
close_paren.column + 1 == semicolon.column since it is the next token and
before the semicolon there is no whitespace. The only problem is if there is a
comment, such as while(0)/**/; and we have no way to track that, have we?.

For a proper fix, we need at least 2 locations for each token that comes from
an expansion. The place where the token really appeared and the place where it
ended up. However, this is not trivial. We need either to encode such
information in 1 location_t number somehow or to encode it in the token.


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36478

Reply via email to