The script to compile with -O2 option is: Raw /usr/bin/gcc -c -m32 -ansi -D_GNU_SOURCE \ -funsigned-char -fno-zero-initialized-in-bss -fno-strict-aliasing \ -DLANGUAGE_C -Wall -Wno-strict-aliasing -Wextra -Werror \ -O2 \ -pipe -Wstrict-prototypes -Wmissing-prototypes test_code...
-Wvolatile-register-var -Wzero-length-bounds -Wextra extra检测项是all的补充,启用了all未启用的一些额外警告标志。包括一些不是那么常用的检测项,具体如下: -Wabsolute-value (only for C/ObjC) -Walloc-size -Wcalloc-transposed-args -Wcast-function-type -Wclobbered -Wdangling-reference (C++ only) ...
附加警告的说明符; 例如-Werror =开关将由-Wswitch控制的警告转换为错误。 此开关采用否定形式,用于否定-针对特定警告的错误; 例如-Wno-error =开关使得-wswitch警告不是错误,即使在-Werror有效时也是如此。 每个可控警告的警告消息都包含控制警告的选项。 那么该选项可以与-Werror =和-Wno-error =一起使用 ,...
-Warray-bounds=1 数组越界检查,需启用选项-ftree-vrp 完整的列表参见链接Warning-Options。 当需要排除某些类型的警告时,记得使用-Wno-xxx, 比如使用-Wall -Wno-unused-variable可以从-Wall中排除-Wunused-variable。 2 -Wextra 单单只有-Wall可能还不够严格,GCC还有-Wextra作为补充,包括另外一些没有被-Wall包含...
-Warray-bounds=1 (only with -O2) -Wc++11-compat -Wc++14-compat -Wchar-subscripts -Wenum-compare (in C/ObjC; this is on by default in C++) -Wimplicit-int (C and ObjecTIve-C only) -Wimplicit-funcTIon-declaraTIon (C and ObjecTIve-C only) ...
-Werror Make all warnings into errors -Wall -Wallturns on the following warning flags: --Waddress -Warray-bounds (only with -O2) -Wc++11-compat -Wchar-subscripts -Wenum-compare (in C/ObjC; this is on by default in C++) -Wimplicit-int (C and Objective-C only) ...
-Walign-commons 对 COMMON 块对齐的警告 -Wall 启用大部分警告信息 -Wampersand 若延续字符常量中缺少 & 则给出警告 -Warray-bounds 当数组访问越界时给出警告 -Warray-temporaries 创建临时数组时给出警告 -Wassign-intercept 当 Objective-C赋值可能为垃圾回收所介入时给出警告 ...
-Werror:不区分警告和错误,遇到任何警告都停止编译 -Wall:开启大部分警告提示 -Wshadow:某语句块作用域变量与更大作用域的另一变量同名时发出警告(此警告未包含在-Wall选项中,需单独开启)
-Werror Make all warnings into errors -Wall -Wall turns on the following warning flags: --Waddress -Warray-bounds (only with -O2) -Wc++11-compat -Wchar-subscripts -Wenum-compare (in C/ObjC; this is on by default in C++) -Wimplicit-int (C and Objec...
-Waddress -Warray-bounds=1 (only with -O2) -Wc 11-compat -Wc 14-compat -Wchar-subscripts -Wenum-compare (in C/ObjC; this is on by default in C ) -Wimplicit-int (C and Objective-C only) -Wimplicit-function-declaration (C and Objective-C only) -Wbool-compare -Wduplicated-cond ...