[cfe-dev] Preprocessor operators for #error and #warning

Kyle Sluder kyle at ksluder.com
Sun Apr 13 12:38:34 PDT 2014


On Apr 12, 2014, at 2:34 AM, David Chisnall <David.Chisnall at cl.cam.ac.uk> wrote:
> 
> For _Error, you can use C11's _Static_assert():
> 
> #define fail(msg) _Static_assert(0, msg)
> 
> There's no standard equivalent for #warning, unfortunately.

That workaround is sufficient for my use case, but the output is noisy and as you note it doesn’t work for those who treat warning differently from errors.

So, can anyone opine on whether such a patch would be accepted?

--Kyle Sluder




More information about the cfe-dev mailing list