10 ms·
I've had good success including not-my-code with the appropriate compiler flag. This tells the compiler that I'm not interested in warnings in those files since
by humanrebar 9y ago
I've had good success including not-my-code with the appropriate compiler flag. This tells the compiler that I'm not interested in warnings in those files since I'm not going to change them.
https://gcc.gnu.org/onlinedocs/cpp/System-Headers.html https://gcc.gnu.org/onlinedocs/cpp/System-Headers.html
- ansgri 9y agoThanks, this looks like a better solution!
- wfunction 9y agoHow does this work with templates? If a type you pass into such a library causes a warning in that library, is that your fault or the library's? How could the compiler possibly tell? It seems like this can't even work in principle if there are templates involved.
- humanrebar 9y agoThe warnings I've had issues with were warnings regardless of whether the code was templates: ignored return values, unused parameters, etc. There may be cases where the potential false negatives are unacceptable. Be judicious, but in my case the benefits far outweighed the risks. Of course, it's a great idea to provide upstream patches and issues whenever possible.
- jcoffland 9y agoThat's good to know. I usually just add a warning suppression or two.