(GCC) How can I hide "defined but not used" warnings in GCC?
2014-12-10 16:36
507 查看
2014-02-14 wcdj
May happy ending of love belong to every developer.
From: http://play.golang.org/p/xl1P6jYtIZ
Question:
How can I hide "defined but not used" warnings in GCC?
Answers:
Just saw this thread while searching for solutions to this problem. I post here for completeness the solution I found...
The GCC compiler flags that control unused warnings include:
Each of these has a corresponding negative form with "no-" inserted after the W which turns off the warning (in case it was turned on by -Wall, for example). Thus, in your case you should use
Of course this works for the whole code, not just compile-time asserts. For function-specific behaviour, have a look atFunction
attributes.
处理办法:
GCC编译有一个参数-Wall,其实是包含其他许多的警告选项,如-Wunused, -Wformat等等。
假如我想使用-Wall选项,但会有许多函数定义未使用的提示,如何在使用-Wall参数的时候关闭-Wunused选项,请问有什么办法?
试试 -Wall -Wno-unused,我这里管用
stackoverflow:
http://stackoverflow.com/questions/386220/how-can-i-hide-defined-but-not-used-warnings-in-gcc
May happy ending of love belong to every developer.
From: http://play.golang.org/p/xl1P6jYtIZ
Question:
How can I hide "defined but not used" warnings in GCC?
Answers:
Just saw this thread while searching for solutions to this problem. I post here for completeness the solution I found...
The GCC compiler flags that control unused warnings include:
-Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wunused (=all of the above)
Each of these has a corresponding negative form with "no-" inserted after the W which turns off the warning (in case it was turned on by -Wall, for example). Thus, in your case you should use
<pre name="code" class="html">-Wno-unused-function
Of course this works for the whole code, not just compile-time asserts. For function-specific behaviour, have a look atFunction
attributes.
处理办法:
GCC编译有一个参数-Wall,其实是包含其他许多的警告选项,如-Wunused, -Wformat等等。
假如我想使用-Wall选项,但会有许多函数定义未使用的提示,如何在使用-Wall参数的时候关闭-Wunused选项,请问有什么办法?
试试 -Wall -Wno-unused,我这里管用
stackoverflow:
http://stackoverflow.com/questions/386220/how-can-i-hide-defined-but-not-used-warnings-in-gcc
相关文章推荐
- (GCC) How can I hide "defined but not used" warnings in GCC?
- How can I hide “defined but not used” warnings in GCC?
- 实用程序软件包(关于使用静态函数报错问题“Static function declared but not defined in C+++ "eh.h is only for C++!"报错问题)
- Eclipse + CDT Program "gcc" not found in PATH
- How to hide the "Repair" option in the .NET installation package
- python 处理中文时出现的错误'ascii' codec can't decode byte 0xe9 in position 0: ordinal not in range(128)" 解决方法
- MPI编译C++程序出现#error "SEEK_SET is #defined but must not be for the C++ binding of MPI" 的解决方法
- wsdl2java "XXX is referenced but not defined."解决办法
- How to get rid of `deprecated conversion from string constant to 'char*'` warnings in GCC?
- Warning: Your Nexus 7 Tablet Is Not Actually a "Tablet" (But Here's How You Make It One)
- jqGrid ---Grid can not be used in this ('quirks...
- Why is the window.close() works in IE browser but not FireFox? "Warning: Scripts may not close windo
- Qt 错误"new types may not be defined in a return type" error
- How to Kill Blanks in a CString,but how to kill Chinese Blanks i can not solve.
- About Derby "ERROR 42X51: The class '***' does not exist or is inaccessible. This can hap pen if the class is not public."
- How to solve "one or more projects in the solution were not loaded correctly" problem?
- "Firefox is already running but is not responding" error message - How to fix it
- jqGrid不支持IE8的解决办法(Grid can not be used in this ('quirks') mode)
- jqGrid不支持IE8的解决办法(Grid can not be used in this ('quirks') mode)
- How can I remove all "name" files in all of my subdirectories on Linux