On 7/10/20 9:37 AM, 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 > > >>> 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. > >>> 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. And just in case you don't get why this is usefull, consider the following CFLAGS settings we are using for our embedded targets: # per target cflags CFLAGS +=$(CFLAGS_$(@:.o=)) That way I can e.g. set generic warning and optimization levels in CFLAGS. If I need to override something for specific targets I just write: # disable -Wcast-qual where necessary CFLAGS_dprintf =-Wno-cast-qual # Optimize for space and not for speed CFLAGS_inner =-Os Regards, Matthias -- Matthias Pfaller Software Entwicklung marco Systemanalyse und Entwicklung GmbH Tel +49 8131 5161 41 Hans-Böckler-Str. 2, D 85221 Dachau Fax +49 8131 5161 66 http://www.marco.de/ Email leo@xxxxxxxx Geschäftsführer Martin Reuter HRB 171775 Amtsgericht München
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature