Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable GCC warning about the #warning directive being a GCC extension?

When using the #warning directive, rather than one warning I get two - the one I generate, plus an additional warning: #warning is a GCC extension [enabled by default].

I can suppress the #warning directive's result itself, with -Wno-cpp, but that's the opposite of what I want.

I can work around this by instead using #pragma message() but that seems to render the #warning directive rather pointless - is there no way to suppress this warning warning?

like image 530
Riot Avatar asked Jun 01 '13 12:06

Riot


1 Answers

Ah, it seems the -pedantic option enables this warning, and there does not seem to be a specific override for it, as there is with most other GCC warnings. Removing -pedantic gets rid of the warning about a warning.

like image 191
Riot Avatar answered Sep 21 '22 04:09

Riot