Hi,

For one reason or another, I have spent a fair amount of time reading and getting confused by the warnings documentation. This applies to the optimizations as well, but I thought I would start with the warnings. Today I sat down and created a dependency graph for all of the options in this node. I made this at first for my own benefit, and then realized that other people might be interested in the information.

I have attached the graph. I am asking for one or more people to comment on its correctness, and what I consider to be errors, as indicated in comments.

Then I have the following proposal for cleaning up the options node in invoke.texi:

1. Create a default section, at the top, and put all options enabled by default there.

2. Try to group options so that they are closer to other connected nodes in the graph.

3. Get rid of the -Wno-xxx option listings, since it is not always the case that -Wxxx is enabled by "default", and this just ends up being rather confusing. Instead, explain in the default section that everything there can be disabled with -Wno-xxx.

4. For each option, specify connected options systematically, perhaps using the syntax I invented, perhaps using a different and more natural (i.e. plain old English) syntax.

5.  Fix what I have labelled as errors.

In a dream world where I had infinite time, I would invent a grammar for specifying relationships between options and then use that to generate number 4 above, and also use it to generate the option parsing bits of the front end.

Cheers,
Chris
# A --> B        option A implies option B
# A --> B C      option A implies options B and C
# A && B --> C   options A and B together imply C

# A <-- B        option A is implied by option B.
# A <-- B || C   option A is implied by either option B or option C
# A <-- B && C   option A is implied by options B and C together

# A ==> B        option A enables option B
# A ==> B C      option A enables options B and C
# A <== B        option A requires option B (depends on B)

default --> -Wimport -Wdiv-by-zero -Wendif-labels -Wattributes -Wmultichar
            -Wnormalized=nfc -Wdeprecated-declarations -Winvalid-offset-of
            -Wint-to-pointer-cast -Wpointer-to-int-cast

-fsyntax-only

-pedantic --> -Wlong-long -Wvariadic-macros -Wpointer-sign
-pedantic <-- -pedantic-errors

-pedantic-errors --> -pedantic

-w

-Wimport <-- default

-Wchar-subscripts <-- -Wall

-Wcomment <-- -Wall

-Wfatal-errors

-Wformat --> -Wnonnull -Wformat-extra-args -Wformat-zero-length
-Wformat <-- -Wformat=2 || -Wall
-Wformat ==> -Wformat-y2k -Wformat-nonliteral -Wformat-security

-Wformat-y2k <== -Wformat

-Wno-format-extra-args <== -Wformat # false dependency

-Wno-format-zero-length <== -Wformat # false dependency

-Wformat-nonliteral <== -Wformat

-Wformat-security <== -Wformat

-Wformat=2 --> -Wformat -Wformat-y2k -Wformat-nonliteral -Wformat-security

-Wnonnull <-- -Wall || -Wformat

-Winit-self <== -Wuninitialized # depends not only on -O1, but -O(1|2|3|s)

-Wimplicit-int <-- -Wall

-Wimplicit-function-declaration <-- -Wall

-Werror-implicit-function-declaration

-Wimplicit --> -Wimplicit-int -Wimplicit-function-declaration
-Wimplicit <-- -Wall # redundant implication

-Wmain <-- -Wall

-Wmissing-braces <-- -Wall

-Wmissing-include-dirs

-Wparentheses <-- -Wall

-Wsequence-point <-- -Wall

-Wreturn-type <-- -Wall

-Wswitch <-- -Wall

-Wswitch-default

-Wswitch-enum

-Wtrigraphs <-- -Wall

-Wunused-function <-- -Wall

-Wunused-label <-- -Wall

-Wunused-parameter <-- -Wextra && -Wunused
-Wunused-parameter <-- -Wextra && -Wall # redundant implication

-Wunused-variable <-- -Wall

-Wunused-value <-- -Wall

-Wunused --> -Wtrigraphs -Wunused-function -Wunused-label -Wunused-variable
             -Wunused-value
-Wunused <-- -Wall # redundant implication

-Wuninitialized <-- -Wall
-Wuninitialized ==> -Winit-self
-Wuninitialized <== -O(1|2|3|s)

-Wunknown-pragmas <== -Wsystem-headers # undocumented

-Wpragmas <-- -Wall # missing "This warning is enabled by `-Wall'".

-Wstrict-aliasing <-- -Wall || -Wstrict-aliasing=2

-Wstrict-aliasing=2 --> -Wstrict-aliasing
-Wstrict-aliasing=2 <== -fstrict-aliasing

-Wall --> -Wchar-subscripts -Wcomment -Wformat -Wnonnull -Wimplicit-int
          -Wimplicit-function-declaration -Wimplicit -Wmain -Wmissing-braces
          -Wparentheses -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs
          -Wunused-function -Wunused-label -Wunused-variable -Wunused-value
          -Wunused -Wuninitialized -Wpragmas -Wstrict-aliasing -Wpointer-sign

# clearly not "All of the above -W options combined."
# note that -Wpointer-sign is also below this point.

-W --> -Wextra

-Wextra --> -Wsign-compare -Wmissing-field-initializers

-Wextra && -Wunused --> -Wunused-parameter # s/arguments/parameters/
-Wextra && -Wall --> -Wunused-parameter # redundant implication

-Wdiv-by-zero <-- default

-Wsystem-headers ==> -Wunknown-pragmas

-Wfloat-equal

-Wtraditional

-Wdeclaration-after-statement

-Wundef

-Wendif-labels <-- default

-Wshadow

-Wlarger-than-LEN

-Wunsafe-loop-optimizations

-Wpointer-arith

-Wbad-function-cast

-Wc++-compat

-Wcast-qual

-Wcast-align

-Wwrite-strings

-Wconversion

-Wsign-compare <-- -Wextra

-Waggregate-return

-Wattributes <-- default

-Wstrict-prototypes

-Wold-style-definition

-Wmissing-prototypes

-Wmissing-declarations

-Wmissing-field-initializers <-- -Wextra

-Wmissing-noreturn

-Wmissing-format-attribute

-Wmultichar <-- default

-Wnormalized=none

-Wnormalized=id

-Wnormalized=nfc <-- default

-Wnormalized=nfkc

-Wdeprecated-declarations <-- default

-Wpacked

-Wpadded

-Wredundant-decls

-Wnested-externs

-Wunreachable-code

-Winline

-Winvalid-offset-of <-- default

-Wint-to-pointer-cast <-- default

-Wpointer-to-int-cast <-- default

-Winvalid-pch

-Wlong-long <-- default   # not actually the case
-Wlong-long <== -pedantic # should be <-- pedantic

-Wvariadic-macros <-- default # not actually the case
-Wvariadic-macros <-- -pedantic

-Wvolatile-register-var

-Wdisabled-optimization

-Wpointer-sign <-- -Wall || -pedantic

-Werror

-Wstack-protector <== -fstack-protector

Reply via email to