Author Topic: how to disable specific warning??  (Read 7436 times)

Offline idhan

  • Multiple posting newcomer
  • *
  • Posts: 26
how to disable specific warning??
« on: March 13, 2007, 01:30:54 am »
Hi,

I am compiling some wxwidgets examples and I get some warrings (actually is always the same)

/usr/local/include/wx-2.8/wx/hashmap.h:714: warning: dereferencing type-punned pointer will break strict-aliasing rules
..
..
/usr/local/include/wx-2.8/wx/image.h:136: warning: dereferencing type-punned pointer will break strict-aliasing rules
:: === Build finished: 0 errors, 10 warnings ===

Two question: How can I see the specific code-warning and after I know that..how can I disable this warning using the code-warning in the compilation process. But only that one, no others important warnings.

thanks for you help.

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: how to disable specific warning??
« Reply #1 on: March 13, 2007, 02:20:34 am »
How can I see the specific code-warning
I'm not sure I understand this question...

Quote
and after I know that..how can I disable this warning using the code-warning in the compilation process.
This question is related more to GCC itself than Code::Blocks. You may be able to find an appropriate parameter in the GCC manual.
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

Offline idhan

  • Multiple posting newcomer
  • *
  • Posts: 26
Re: how to disable specific warning??
« Reply #2 on: March 13, 2007, 12:02:04 pm »
Hi,

I will give you an example: On visual studio I get some warning too (compiling some wxwidgets examples), but on visual studio I get not only the description warning also  a number (or code), so, with that code I can disable this (or several) warning in the settings of my project (Disable Specific Warning: code1,code2,etc).

On Code::blocks I only get the description, but not the number or code of the warning and that is my problem, also I don't know if code::blocks has the settings (Disable Specific Warning) or I have to search for the gcc manual on read about it.

thanks again :-)

wxLearner

  • Guest
Re: how to disable specific warning??
« Reply #3 on: March 13, 2007, 12:10:13 pm »
Hello, you can suppress specific warnings in compiler settings by using the other options tab. Like TDragon said, look into the gcc manual for details, how to suppress a specific warning:
http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Warning-Options.html#Warning-Options

Edit:
I think, the option you look for is:
Code
-Wno-strict-aliasing
« Last Edit: March 13, 2007, 12:16:16 pm by wxLearner »