Sign in to follow this  
sebarnolds

Hiding warnings about std::vector, std::string...

Recommended Posts

sebarnolds    168
Hi everybody. I'm have almost finished writing my Makefiles for my current project. I have an annoying problem. I activate a bunch of warnings in my gcc options in order to detect things like unreachable code instructions. The problem is that std::vector, std::string and other includes like these contain code which triggers warnings. I obviously don't want to see these warnings but I don't know how to hide them. In gcc manual, when describing the warning about effective c++ warnings, it is said that we must use grev -v to remove unwanted warnings from the stl. However, each of these warnings take more than one line and I don't know how to remove all the unwanted lines. Warnings are like this:
In file included from blabla.cpp,
In file include from blabla.hpp,
In file string.h
Warning: unreachable code in ...

Anybody knows how to not display these warnings ? Thanks.

Share this post


Link to post
Share on other sites
Conner McCloud    1135
I suspect -Wno-unreachable-code will do the trick, but I'm not 100% sure. *edit: Also, warnings in system headers should be ignored by default...-Wno-system-headers could also work if that option got turned on for some reason.

CM

Share this post


Link to post
Share on other sites
sebarnolds    168
Hi.

Thanks for your reply.

In fact, I activated the opposite of -Wno-unreachable-code in order to see when I have unreachable code (you know, when you do some debugging, you sometimes forget to set things back like removing "return;" from function).

About -Wno-system-headers, I already turned this on and it doesn't change anything. I guess gcc doesn't consider vector, string and such ones as system headers.

Anybody has another idea ?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this