Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22051

GCC Exclude User-Defined Warnings from -Werror

$
0
0

I want to pass the -Werror argument to gcc during compilation. The issue is that the code I am compiling has pragma statements such as:

#pragma GCC warning "Custom warning message"

I should be able to add an argument like -Wno-error=pragmas to the command line to enable retaining these lines as warnings. However, when I grepped the output of gcc --help=warnings for pragma, user, and explicit, I can't find the name of the warning switch I need to use. Does anyone know how to exclude explicit #pragma warnings from being errors when -Werror is enabled?

I've also tried to modify the #pragma to the following, which the GCC documentation seems to indicate should also accomplish this:

#pragma GCC diagnostic push#pragma GCC diagnostic warning "-Wall"#pragma GCC warning "Custom warning message"#pragma GCC diagnostic pop

My GCC version is 11.4.0.


Viewing all articles
Browse latest Browse all 22051

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>