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

How to enable -Werror using GCC pragma?

$
0
0

I have a few files where i'd like to be strict about warnings, and i use GCC to build my project.

I've tried #pragma GCC diagnostic error "-Wall" as per https://gcc.gnu.org/onlinedocs/gcc-4.7.2/gcc/Diagnostic-Pragmas.html, but it fails to account for some other enabled warning types:

foo.c:666:6: warning: passing argument 2 of 'bar' from incompatible pointer type [-Wincompatible-pointer-types]

Is there a way to enable -Werror for the file like it was supplied from the command line (or, at least, for the implicitly enabled set of warnings), so any warning would trigger an error?


Viewing all articles
Browse latest Browse all 22042

Trending Articles



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