On 2020-07-10 08:37 +0100, Jonny Grant wrote: > Thank you for you reply. > > On 10/07/2020 00:58, Jonathan Wakely wrote: > > On Thu, 9 Jul 2020 at 23:54, Jonny Grant <jg@xxxxxxxx> wrote: > > > Hello > > > > > > I noticed g++ ignores -W as I understand it that alone doesn't turn > > > anything on? > > > > No, -W is identical to -Wextra. > > I looked but couldn't find any mention of it. > > Is it worth documenting this on the page? > https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html It's already there: > -Wextra > This enables some extra warning flags that are not enabled by -Wall. (This > option used to be called -W. The older name is still supported, but the newer > name is more descriptive.) > > > https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html > > > > > > Also may I ask if specifying both -pedantic -Wpedantic be an error? They > > > are the same as I understand. g++ doesn't reject them both being > > > specified. > > > > They mean the same thing. It's not an error to repeat options. > > Fair enough, it doesn't help anyone remove duplicates from their warning list > in makefile etc though. In many real packages the building system just works fine with a lot of duplicates. Even the building system of GCC itself compiles many files with duplicated options. If you really hate duplicates it's simple to find them: echo $CFLAGS | sed 's@ @\n@g' | grep -v "^$" | uniq -d > > > Another example is -O1 -O0 -O3, the later -03 seems to be used. Maybe nice > > > to say too many optimization options specified? > > > > No, it's common (and very useful) to append an option to the end of a > > command and have it override earlier options. > > > > This behaviour is documented, and relied on by many people. > > clang gives a nice helpful warning I recall. No. You can try: $ clang -O1 -O0 -O3 test.c (no diagnostics) > I usually just amend the optimisation earlier in the command line myself. > > > This isn't directly related, but the main page doesn't show what version of > GCC it refers to > https://gcc.gnu.org/onlinedocs/gcc/ > > Could the page show what version it is on that page? git master. -- Xi Ruoyao <xry111@xxxxxxxxxxxxxxxx> School of Aerospace Science and Technology, Xidian University