CFLAGS += -w 或者针对特定类型的警告: makefile CFLAGS += -Wno-int-to-pointer-cast 这样,每次执行make命令时,都会应用这些警告选项。 验证警告是否已被关闭: 在修改编译命令或Makefile后,重新执行编译命令,并检查输出中是否还包含你之前希望关闭的警告信息。如果警告信息不再显示,说明你已经成功关闭了这些警告。 通过以上方法,你可以灵活地控制GCC编译时的警告显示行为。
-Wnon-template-friend 在模板内声明未模板化的友元函数时给出警告 -Wnon-virtual-dtor 当析构函数不是虚函数时给出警告 -Wnonnull 当将 NULL 传递给需要非 NULL的参数的函数时给出警告 -Wnormalized=<id|nfc|nfkc> 对未归一化的 Unicode 字符串给出警告 -Wold-style-cast 程序使用 C风格的类型转换时给出...
-Wpointer-arith 当在算术表达式中使用函数指针时给出警告 -Wpointer-sign 赋值时如指针符号不一致则给出警告 -Wpointer-to-int-cast 将一个指针转换为大小不同的整数时给出警告 -Wpragmas 对错误使用的 pragma 加以警告 -Wproperty-assign-default Warn if a property for an Objective-C object has no assi...
-Wcast-align 当转换指针类型导致对齐边界增长时给出警告 -Wcast-qual 当类型转换丢失限定信息时给出警告 -Wchar-subscripts 当下标类型为“char”时给出警告 -Wcharacter-truncation 对被截断的字符表达式给出警告 -Wclobbered 对能为"longjmp"或"vfork"所篡改的变量给出警告 ...
-Wpointer-arith 当在算术表达式中使用函数指针时给出警告 -Wpointer-sign 赋值时如指针符号不一致则给出警告 -Wpointer-to-int-cast 将一个指针转换为大小不同的整数时给出警告 -Wpragmas 对错误使用的 pragma 加以警告 -Wproperty-assign-default Warn if a property for an Objective-C object has ...
-Wimplicit-int 当声明未指定类型时给出警告 -Wimport 此开关缺少可用文档 -Winherited-variadic-ctor Warn about C++11 inheriting constructors when the base has a variadic constructor -Winit-self 对初始化为自身的变量给出警告。 -Wint-to-pointer-cast 当将一个大小不同的整数转换为指针时给出警告 ...
-Wcomment -Wdangling-else -Wdangling-pointer=2 -Wdelete-non-virtual-dtor (C++ and Objective-C++ only) -Wduplicate-decl-specifier (C and Objective-C only) -Wenum-compare (in C/ObjC; this is on by default in C++) -Wenum-int-mismatch (C and Objective-C only) ...
-Wno-int-conversion -Wno-int-to-pointer-cast -Wno-invalid-offsetof -Wno-multichar -Wnonnull -Wno-return-local-addr -Wno-unused-result -Wno-virtual-move-assign -Wnon-virtual-dtor -Woverlength-strings -Woverloaded-virtual -Wpadded -Wparantheses ...
port -Wno-import -Winit-self -Winline -Wno-int-to-pointer-cast -Wno-invalid-offsetof -Winvalid-pch -Wlarger-than-len -Wun- safe-loop-optimizations -Wlong-long -Wmain -Wmissing-braces -Wmissing-field-initializers -Wmissing-format-attribute -Wmiss- ...
静态语言的好处就是变量强制必须指定类型,这也是编译的要求,所以大部分编译型的语言都会有强制变量类型的...