gcc提供了大量的警告选项,对代码中可能存在的问题提出警 告,通常可以使用-Wall来开启以下警告: -Waddress -Warray-bounds (only with -O2) -Wc++0x-compat -Wchar-subscripts -Wimplicit-int -Wimplicit-function-declaration -Wcomment -Wformat -Wmain (only for C/ObjC and unless -ffreestanding) -Wmissin...
2021-W 可以用来打开或者关闭某个告警,比如显示这个告警 -Wsequence-point,要关闭它就写 -Wno-sequence-point。2223-w 关闭所有告警信息2425-Werror 有warning时也当成error来处理,此时编译会终止。2627就是这个选项导致的这这样的错误显示:cc1plus: all warnings being treatedaserrors。快速地解决方法就是去掉-Werr...
-fno-pretty-templates When an error message refers to a specialization of a function template, the compiler normally prints the signature of the template followed by the template arguments and any typedefs or typenames in the signature (e.g. "void f(T) [with T = int]" rather than "void...
; -fcheck-bounds causes gcc to generate array bounds checks. ; For C, C++ and ObjC: defaults off. ; For Java: defaults to on. ; For Fortran: defaults to off. fbounds-check Common Var(flag_bounds_check) Generate code to check bounds before indexing arrays. fbranch-count-reg...
Werror=implicit-function-declaration -Werror=implicit-int -Werror=pointer-sign -Werror=pointer-arith -Werror=int-conversion -Werror=incompatible-pointer-types -Werror=discarded-qualifiers -Werror=discarded-array-qualifiers -Waddress -Warray-bounds -Wchar-subscripts -Wduplicate-decl-specifier -Winit-...
gimple-array-bounds.cc gimple-array-bounds.h gimple-builder.c gimple-builder.h gimple-expr.c gimple-expr.h gimple-fold.c gimple-fold.h gimple-isel.cc gimple-iterator.c gimple-iterator.h gimple-laddress.c gimple-loop-interchange.cc gimple-loop-jam.c gimple-loop-versioning.cc gimple-low.c...
Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-unused-local-typedefs -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=...
-Warray-bounds=1 (only with -O2) -Warray-compare -Warray-parameter=2 -Wbool-compare -Wbool-operation -Wc++11-compat -Wc++14-compat -Wc++17compat -Wc++20compat -Wcatch-value (C++ and Objective-C++ only) -Wchar-subscripts -Wclass-memaccess (C++ and Objective-C++ only) ...
/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.c ...
-Warray-bounds=1 数组越界检查,需启用选项-ftree-vrp 完整的列表参见链接Warning-Options。 当需要排除某些类型的警告时,记得使用-Wno-xxx, 比如使用-Wall -Wno-unused-variable可以从-Wall中排除-Wunused-variable。 2 -Wextra 单单只有-Wall可能还不够严格,GCC还有-Wextra作为补充,包括另外一些没有被-Wall包含...