Author Topic: suggestion: supress warnings of included headers of libraries  (Read 8882 times)

Offline chameleon

  • Multiple posting newcomer
  • *
  • Posts: 40
suggestion: supress warnings of included headers of libraries
« 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.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7790
    • My Best Post
Re: suggestion: supress warnings of included headers of libraries
« Reply #1 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.
C Programmer working to learn more about C++ and Git.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: suggestion: supress warnings of included headers of libraries
« Reply #2 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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: suggestion: supress warnings of included headers of libraries
« Reply #3 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?
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: suggestion: supress warnings of included headers of libraries
« Reply #4 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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Audiodroid

  • Single posting newcomer
  • *
  • Posts: 7
Re: suggestion: supress warnings of included headers of libraries
« Reply #5 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"
. :-(

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: suggestion: supress warnings of included headers of libraries
« Reply #6 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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ