gcc编译器 CFLAGS 标志参数说明 CFLAGS = -g -O2 -Wall -Werror -Wno-unused 编译出现警告性错误unused-but-set-variable,变量定义但没有使用,解决方法: 增加CFLAGS 或CPPFLAGS参数如下: CPPFLAGS=" -Werror -Wno-unused-but-set-variable" || exit 1 Gcc总体选项列表 ·“-I dir” 正如上表中所述,“-...
◆unused-function:遇到仅声明过但尚未定义的静态函数时发出警告。 ◆unused-label:遇到声明过但不使用的标号的警告。 ◆unused-parameter:从未用过的函数参数的警告。 ◆unused-variable:在本地声明但从未用过的变量的警告。 ◆unused-value:仅计算但从未用过的值得警告。 ◆Format:检查对printf和scanf等函数的调用,...
-Wunused-but-set-variable 对声明且被赋值但未被使用的变量发出警告 -Warray-bounds=1 数组越界检查,需启用选项-ftree-vrp 完整的列表参见链接Warning-Options。 当需要排除某些类型的警告时,记得使用-Wno-xxx, 比如使用-Wall -Wno-unused-variable可以从-Wall中排除-Wunused-variable。 2 -Wextra 单单只有-Wall...
set(CMAKE_C_FLAGS,"-Wall -Werror")//Cset(CMAKE_CXX_FLAGS,"-Wall -Werror")//C++ 2022.11.18 补充 -Wno-unused-variable:不显示未使用的变量告警-Wno-unused-parameter:不显示未使用的参数告警-Wno-unused-function:不显示未使用的函数告警-Wno-unused-but-set-variable:不显示已赋值但未使用的变量告警...
◆unused-function:遇到仅声明过但尚未定义的静态函数时发出警告。 ◆unused-label:遇到声明过但不使用的标号的警告。 ◆unused-parameter:从未用过的函数参数的警告。 ◆unused-variable:在本地声明但从未用过的变量的警告。 ◆unused-value:仅计算但从未用过的值得警告。
MMseqs2 tests their project using Ubuntu 16.04 and -Werror=unused-but-set-variable so they see the following build failures: [ 30%] Building CXX object src/CMakeFiles/mmseqs-framework.dir/alignment/Alignment.cpp.o In file included from /...
如:$ gcc -Wall -Wno-unused test.c -o test gcc官网有专门解释所有告警选项的说明文档。文档中介绍的配置项有几十甚至上百个,按照类型可以把他们分为全局配置、单项配置和检测组合三类。 1 全局配置 告警配置中有一些选项会对全局产生影响,重要的主要有以下几个: ...
otherwise unused -Wunused-but-set-variable Warn when a variable is only set, otherwise unused -Wunused-dummy-argument 对未使用的哑元给出警告。 -Wunused-function 有未使用的函数时警告 -Wunused-label 有未使用的标号时警告 -Wunused-macros 当定义在主文件中的宏未被使用时给出警告 ...
一个项目需要在gcc4.1.2(公司服务器)和gcc4.7.3+(桌面linux系统)上编译,并且存在一些问题:gcc4.1.2没有Wno-unused-result和Wno-unused-but-set-variable我尝试用Wno-unused替换后两者,但是仍然产生了一个内置函数错误的忽略返回值。在gcc4.1.2中也没有Wno-narrowing,还有什么我可以使用的吗?
To suppress this warning use the ‘unused’ attribute (see Variable Attributes). 1. This warning is also enabled by -Wunused together with -Wextra. 1. -Wunused-but-set-parameter 1. Warn whenever a function parameter is assigned to, but otherwise unused (aside from its declaration). ...