On 27.05.2012, at 13:55, Matthieu Monrocq wrote:

> 
> 
> On Sun, May 27, 2012 at 12:30 AM, Alexander Kornienko <[email protected]> 
> wrote:
> 
> P.S. It would also be interesting to know what people think about converting 
> fall-through annotations in comments to a checked annotation so we could use 
> this diagnostic on regular basis?
> We could wrap [[clang::fallthrough]] to a macro, so the code would continue 
> to work in c++98 mode, but in c++11 mode it would also allow to run this 
> diagnostic (btw, is llvm compilable in c++11 mode?). Sample implementation of 
> macro:
> #ifdef __clang__
> #if __has_feature(cxx_attributes) && __has_warning("-Wimplicit-fallthrough")
> #define FALLTHROUGH [[clang::fallthrough]]
> #endif
> #endif
> 
> #ifndef FALLTHROUGH
> #define FALLTHROUGH do { } while (0)
> #endif
> 
> -- 
> Best regards,
> Alexander Kornienko
> 
>  
> One question: in the proposed macro, why not put the the `;` in the macro 
> since it will be mandatory anyway ?

I know several text editors whose simple indentation algorithm gets confused by 
lines not ending in semicolons. I prefer them outside the macro.

Sebastian
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to