g++ warning可以分成三类:
1. -Wall 定义所有构造相关的警告, 用户觉得可疑的, 易规避的, 甚至宏联合的警告. -Wall 包含以下warning flags:
-Waddress -Warray-bounds (须与-O2联用) -Wc++0x-compat -Wchar-subscripts -Wimplicit-int -Wimplicit-function-declaration -Wcomment
-Wformat -Wmain(仅限C/ObjC) -Wmissing-braces -Wnonnull -Wparenthese -Wpointer-sign -Wreorder -Wreturn-type -Wsign-compare(仅限C++)
-Wsequence-point -Wstrict-aliasing -Wstrict-overflow=1 -Wswitch -Wtrigraphs
-Wuninitialized -Wunknown-pragmas -Wunused-function -Wunused-label -Wunused-value -Wunused-variable -Wvolatile-register-var
2. -Wextra 定义一部分除-Wall以外的警告, 包含以下warning flags:
-Wclobbered -Wempty-body -Wignored-qualifiers -Wmissing-filed-initializers -Wmissing-paramerter-type(仅限C) -Wold-stype-declaration(仅限C)
-Woverride-init -Wsign-compare -Wtype-limits -Wuninitialized -Wunused-parameter(须于-Wunused或-Wall联用)
以下情况-Wextra也会显示warning信息: