public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Stephan Thomas Lavavej <stl@caltech.edu>
To: gcc@gcc.gnu.org
Subject: Lots of suggestions for the gcc manual
Date: Sat, 13 Sep 2003 15:00:00 -0000	[thread overview]
Message-ID: <Pine.GSO.4.58.0309130347490.24873@blinky> (raw)

http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#Warning%20Options

1. Currently, it is very unclear which warnings are part of -Wall
and which are not. In the middle of the page:

> -Wall
> All of the above -W options combined.
> [...]
> The following -W... options are not implied by -Wall.

That would be nice if only it were true. Above -Wall we see:

> -Wformat
> Check calls to printf and scanf
> [...]
> -Wformat is included in -Wall. For more control over some aspects of
> format checking, the options -Wno-format-y2k, -Wno-format-extra-args,
> -Wno-format-zero-length, -Wformat-nonliteral, -Wformat-security, and
> -Wformat=2 are available, but are not included in -Wall.

> -Wno-format-y2k [...]

This is a -W option that appears above -Wall but is not included in -Wall.
Uh oh. Maybe it counts as a -Wno option and so obviously wouldn't be
included in -Wall.

Well, the wording, namely:

> If -Wformat is specified, do not warn about strftime formats which may
> yield only a two-digit year.

makes it pretty clear that it's used on top of -Wformat in order to
*disable* some of -Wformat's functionality. I guess it makes sense, though
the presentation could stand to be a bit clearer. It gets worse, though:

> -Wformat-nonliteral
> If -Wformat is specified, also warn if the format string is
> not a string literal [...]

This is a -W option that turns on more warnings, and appears above -Wall
but is not part of -Wall.

Confusing! It's a mess.

2.
> -Wnonnull is included in -Wall and -Wformat.
> It can be disabled with the -Wno-nonnull option.

The second sentence here is redundant - it already says at the top of the
page how any option can be toggled.

I propose a clearer layout would be to begin the document with
-fsyntax-only, -pedantic, -pedantic-errors, and -w as it currently
does, and then to begin a whole new section: Warnings Included In -Wall.
Every warning that -Wall enables would go in that section and nothing
else. If a warning can be further modified, as -Wformat can be, then
it should link to /another/ section that explains all the modifications
that can be done, but under no circumstances should any warnings not
in -Wall appear in the -Wall section.

3.
> -Winit-self (C, C++, and Objective-C only)
> Enable warning about

The rest of the options say "warn if", "warn whenever", etc. "Warn about"
would fit perfectly here and be shorter as well as more consistent.

> uninitialized variables which are
> initalized

Misspelled.

> Note this option can only be used with the -Wuninitialized option and
> that only works with -O.

Does it work with -O2, etc?

> For an example,

Would "For example" be better?

> the following code will not warn about i

Elsewhere, variables that appear in the main text are in monospace.
This occurrence of i is not.

In fact, the whole sentence

> the following code will not warn about i being uninitialized
> without this option

is pretty icky. Does code warn, or does gcc warn? And the sentence
uses a confusing double negative.

4.
> -Wstrict-aliasing
[...]
> It is included in -Wall.

The reorganization I suggest in (2) would make this sentence redundant.

5. Shouldn't -Wlong-long appear next to -pedantic?

6. There are several "(C++ only)" warnings listed on this page. Yet more
appear in the separate page Options Controlling C++ Dialect.
Why does -Wno-invalid-offsetof get to be in Options To Request Or
Suppress Warnings while -Wold-style-cast languishes in Options Controlling
C++ Dialect? There doesn't seem to be any rhyme or reason to this.

Stephan T. Lavavej
http://stl.caltech.edu


             reply	other threads:[~2003-09-13 10:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-13 15:00 Stephan Thomas Lavavej [this message]
2003-09-14 22:10 ` Kai Henningsen
2003-09-21 17:20   ` Gerald Pfeifer
2003-10-03 18:54 ` PATCH for: " Gerald Pfeifer
2003-10-04 18:38   ` Stephan T. Lavavej
2003-10-05 21:30     ` Gerald Pfeifer
2004-02-16  2:27       ` [PATCH] GCC Warning Options Documentation Stephan T. Lavavej
2004-02-16  3:33         ` James Morrison
2004-03-27 15:38         ` Gerald Pfeifer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.GSO.4.58.0309130347490.24873@blinky \
    --to=stl@caltech.edu \
    --cc=gcc@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).