I was instructed that the current Automake file disables some warnings, and we want full warnings in our build...
This is the relevant Automake lines.
AM_CXXFLAGS = -std=c++14
AM_CXXFLAGS += -Wno-memset-elt-size
AM_CXXFLAGS += -faligned-new
AM_CXXFLAGS += -DXSD_CXX11
AM_CXXFLAGS += -Wno-stringop-truncation
AM_CXXFLAGS += -Wno-stringop-overflow
AM_CXXFLAGS += -Wno-int-in-bool-context
AM_CXXFLAGS += -D_FILE_OFFSET_BITS=64
AM_CXXFLAGS += -D_REENTRANT
AM_CXXFLAGS += -D__STDC_FORMAT_MACROS
AM_CXXFLAGS += -fPIC
AM_CXXFLAGS += -fmessage-length=0
AM_CXXFLAGS += -Wall
AM_CXXFLAGS += -Wsign-compare
AM_CXXFLAGS += -Wfloat-equal
AM_CXXFLAGS += -Wno-unused-label
AM_CXXFLAGS += -Wshadow
I have difficulty finding documentation for all these gcc flags. Can someone tell me what lines should I remove, in order to have full warnings in the build?
You have
-Walland a few-Wfooand a few-Wno-fooarguments.-Wallenables a certain set of warnings-Wfooenables thefoowarning-Wno-foodisables thefoowarningSo as it stands, you have the
-Wallset of warnings enabled plus some others and minus some others.Somewhat counterintuitively, some
-DFOOand-ffooarguments enable extra compiler functions which are in turn required for producing some warnings.If you want "all" warnings, you need to consult your specific compiler version's documentation and read up on all the warnings, the warnings enabled by
-Wallwhich is NOT all of them, and what other warnings the compiler offers.On gcc,
-pedanticcan additionally enable language lawyer type warnings and-Wextraenables many warnings which are not included in-Wall.Why only many warnings? Some warnings need special
-farguments activating specific compiler features which are needed for that warning.The clang compilers also work with
-pedantic,-Walland-Wextra, but they have-Wmostas well.Note that clang's
-Weverythingis for testing the clang compiler, not for compiling code. Some warnings in-Weverythingcan be mutually exclusive, i.e. either some program code produces either warning A or warning B, and there is no way to write the code to produce neither.I personally like the compiler to produce as many warnings as I can reasonably enable, and therefore I use
-pedantic -Wall -Wextrawith gcc and add-Wmoston clang.OK, and I make every warning an error using
-Werror, but that exceeds the scope of this question.