I'm building my program with -pedantic
flag, which causes an extra ';'
error (because of a third-party header using a few macros inconsistently; the error is not shown when -pedantic
is off). I don't really feel like turning -pedantic
off, and neither do I want to edit the header. Is there any way to suppress this exact error? Like a -Wno-annoying-semicolon-error
compiler switch or something?
You can suppress pedantic warnings for external headers like this:
//save compiler switches
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
//Bad headers with problem goes here
#include <ros/ros.h>
#include <sensor_msgs/LaserScan.h>
//restore compiler switches
#pragma GCC diagnostic pop
Use -isystem
rather then -I
when passing include paths, then GCC won't warn you about system headers.
For any headers you maintain, just edit them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With