Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: chameleon on November 11, 2009, 03:19:09 pm

Title: suggestion: supress warnings of included headers of libraries
Post by: chameleon on November 11, 2009, 03:19:09 pm
The idea comes from this:

My program uses 'boost'. 'boost' has a lot of headers and they create lots of innocent warnings.

I don't care about 'boost' warnings. Only about my program's warnings.

So the suggestion:

A (default: off) option in CodeBlocks preferences which suppress in window 'build messages' all warnings come from files not included in project.

So if header is "boost_thread.hpp" no warnings because does not belong to project's files.
if header is "my_program_header.h" warnings appear because it is project's file.

I need to know what is your thought about this.
Title: Re: suggestion: supress warnings of included headers of libraries
Post by: stahta01 on November 11, 2009, 03:27:55 pm
Not worth doing in my opinion; have you looked at the compiler to see if you can fix it in the source code?

GCC has the idea of system headers that reduce the messages the compiler generates on "system headers"

Tim S.
Title: Re: suggestion: supress warnings of included headers of libraries
Post by: MortenMacFly on November 11, 2009, 03:40:56 pm
So if header is "boost_thread.hpp" no warnings because does not belong to project's files.
Possible and implemented in trunk. Check the compiler options, tab "Other settings" -> "Compiler putput to be ignored". Add "boost_thread.hpp" to these strings and you are done. It has some side effects, though: It's slower and you might also filter lines of an error that does not have it's root in this header, but this header might be in the error message as reference. So take care.
Title: Re: suggestion: supress warnings of included headers of libraries
Post by: thomas on November 12, 2009, 10:49:08 am
I wasn't sure whether I should complain about another useless feature or praise the best idea ever. I've settled for the latter, if it works (not tried yet), then it's really great  :)

What's with template warnings/errors, though? These would often be be of the form
Code
xyz/boost/detail/blah-impl.hpp : 123:  (blah blah blah)
instanciated from: xyz/boost/blah.hpp : 643
instanciated from: (...)
instanciated from: myprojects/blubb/blubb.cpp : 34
What's interesting about the message is the very last line, which points to the actual error. However, as I understand it, the whole message might get filtered now?
Title: Re: suggestion: supress warnings of included headers of libraries
Post by: MortenMacFly on November 12, 2009, 12:16:47 pm
However, as I understand it, the whole message might get filtered now?
Depends on the filter you setup. What you want is filtering lines with "xyz/boost" probably. In that case there last lien would remain and the previous ones are hidden.

Look: For me it already is/was really helpful to filter annoying warning messages coming from wx when I enable "all warnings" from the compiler. I don't want to modify the wx (whats-o-ever) framework, just my code. For this purpose it's working great I'd say... for me at least.
Title: Re: suggestion: supress warnings of included headers of libraries
Post by: Audiodroid on October 14, 2011, 05:35:39 pm
I would like to use the suggested filter option. But I can't figure out how you suggest to do it. Could you elaborate a bit more on how it works.

I' lost in
Settings=> Compiler and Debugger...
"Other Settings" - Tab

What am I suppose to do here?

(I also clicked on "Advance...")
I could not find anything like
Quote
"Compiler putput to be ignored"
. :-(
Title: Re: suggestion: supress warnings of included headers of libraries
Post by: MortenMacFly on October 15, 2011, 03:16:15 pm
I could not find anything like
Quote
"Compiler putput to be ignored"
. :-(
Well, you should always start with telling what version and platform your are using, otherwise it's hard to help.

So I guess you are on Windows and running a recent nightly. In that case, the option is under:
Settings -> Compiler -> [select your compiler] -> Other settings -> Below "Build method" you'll find the "Compiler output to be ignored". Just enter a keyword / phrase in the text box and hit "add".

BTW: Next time please also don't hijack a 2 year old thread. It's better to create a new one, referring to this. The reason is, that otherwise all people listening to this thread (who's answer is already been given) get an email notification after years.