[solved]mingw pragma warning disable
[solved]mingw pragma warning disable
Is that really true that mingw doesn't allows to disable specific pragma warnings? I think that disabling warning is really usefull when needed. Because they usually hide warnings wich needs more attention and reduce compile time if they are too many.
EDIT: thanks you docWild. It worked!
EDIT: thanks you docWild. It worked!
Last edited by REDDemon on Sun Dec 11, 2011 1:40 pm, edited 1 time in total.
Junior Irrlicht Developer.
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
Re: mingw pragma warning disable
It is possible to turn off every warning, not sure about turning off specific ones. But if you're concerned about compile time, why not turn off all of the warnings and when you need to check for warnings turn them back on?
Working on game: Marrbles (Currently stopped).
Re: mingw pragma warning disable
You can disable warnings globally with compiler options. Check the gcc manual for that. Disabling them only per file wasn't possible in the past, it might be possible when gcc 4.6 hit's MinGW: http://stackoverflow.com/questions/9650 ... ation-unit
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
-
- Posts: 1186
- Joined: Fri Dec 29, 2006 12:04 am
Re: mingw pragma warning disable
Warnings are there for a reason. I'd fix my code rather than disabling the warnings...
"Whoops..."
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Re: mingw pragma warning disable
Problem is if your library provider won't think the same as you, though. Then it becomes handy to disable warnings when including external headers, and re-enable them later on. But of course this is still a workaround, just one which is mostly inevitable otherwise
Re: mingw pragma warning disable
For broken external includes, use -isystem instead of -I and they don't get scanned for warnings.
/me always runs with -Wall -Wextra.
/me always runs with -Wall -Wextra.
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Re: mingw pragma warning disable
Oh, didn't knew that.
Re: mingw pragma warning disable
I usually enable always Wall Wextra. And I disable all warnings in the release version. But the point is that Some warnings are thrown because of certain choices (for example reinterpret casting a pointer to u32 to a pointer to f32 etc..) I wanted to disable warning on a per-file basis in order to hide wanted warnings and easily catch unwanted warnings and fixe the code for them. In visual studio this is possible. Don't know if and how with mingw.
Junior Irrlicht Developer.
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
Re: mingw pragma warning disable
Something like -WconversionREDDemon wrote:I usually enable always Wall Wextra. And I disable all warnings in the release version. But the point is that Some warnings are thrown because of certain choices (for example reinterpret casting a pointer to u32 to a pointer to f32 etc..) I wanted to disable warning on a per-file basis in order to hide wanted warnings and easily catch unwanted warnings and fixe the code for them. In visual studio this is possible. Don't know if and how with mingw.
From here http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
Re: mingw pragma warning disable
Are you talking about the hack in irr api where it's needed to pass ints as floats to set GLSL texture units?
-
- Posts: 1186
- Joined: Fri Dec 29, 2006 12:04 am
Re: mingw pragma warning disable
There still is no point in hiding the warnings. If you use an external library and it throws warning on compilation, write an email to the developers and ask them to fix them. If they won't, you still can have a paragraph in your readme.txt which states that the warnings are not from your code but from another library. So more people would email the lazy developers.
Don't hide the truth!
PS: -Werror -pedantic rocks
Don't hide the truth!
PS: -Werror -pedantic rocks
"Whoops..."
Re: mingw pragma warning disable
The point is that when you are writing a library you usually write code wich throws warnings. This is not hiding the truth. The truth is that if you have 50 warnings and 49 of them don't need attention but 1 of them is really imporant you will not notice that error. Disabling warnings where necessary is very usefull. When you have to deal with small libraries it doesn't matter if few warnings are throwed. But when you have dozens of code files and you start getting 300 warnings you want to turn them off (for example building glew usually throws how many warning as the number of wrapped gl functions. But that library is very good indeed this is just a example).randomMesh wrote:There still is no point in hiding the warnings. If you use an external library and it throws warning on compilation, write an email to the developers and ask them to fix them. If they won't, you still can have a paragraph in your readme.txt which states that the warnings are not from your code but from another library. So more people would email the lazy developers.
Don't hide the truth!
PS: -Werror -pedantic rocks
1) warnings are usefull to catch possible errors.
2) if there are too many warnings you will pay less attention on warning wich really need attention.
A good designed code have to shut down unwanted warnings. But disabling warnings separately for each file is possible only in visual studio as far as I know. Spending time on shutting down warnings is not lazy development.Every warning needs attention. After attention has been done on that warning and you think that it is ok, after some test you can disable it and go to the next warning. Using compiler options is not very good since the code becomes IDE/compiler dependent. (how can you put a -Wextra in a .h file?)
Junior Irrlicht Developer.
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
Re: mingw pragma warning disable
You can use pragma.REDDemon wrote:But disabling warnings separately for each file is possible only in visual studio as far as I know.
Code: Select all
#pragma GCC diagnostic ignored "-Wwrite-strings"
I agree with you in that warnings aren't a challenge to developers to test their metal at eradicating them. They are there for information.