[libcpp+C++ PATCH] Fix -Wempty-body C++ warning (PR c++/36478)
Mark Mitchell
mark@codesourcery.com
Mon Nov 10 19:36:00 GMT 2008
>From a technical perspective, I think this patch makes sense. In
particular, using a flag from the preprocessor, rather than poking at
location information, seems OK to me.
But, do we really want to warn about:
while (0);
but not:
while (0) ;
?
That seems surprising to me.
I can understand not warning about:
while (0)
;
which seems a more explicit indication that the user has an infinite
loop there.
If we're using the single space as a way of making -save-temps work
(because an empty macro gets replaced with a space), I think that's just
as fragile a hack as we had before. If we really need to make
-save-temps work, then we need -save-temps to emit something explicit to
mark the presence of the macro.
But, I also don't see it as a crisis if -save-temps doesn't work in this
particular case. Once we decide that the presence of a macro is a
significant fact, we also accept that preprocessing the code is going to
result in a change. That might argue that using the presence of a macro
is a mistake...
--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713
More information about the Gcc-patches
mailing list