From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 45612 invoked by alias); 10 Dec 2015 16:52:42 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 45595 invoked by uid 89); 10 Dec 2015 16:52:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-qg0-f46.google.com Received: from mail-qg0-f46.google.com (HELO mail-qg0-f46.google.com) (209.85.192.46) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 10 Dec 2015 16:52:40 +0000 Received: by qgea14 with SMTP id a14so152086512qge.0 for ; Thu, 10 Dec 2015 08:52:38 -0800 (PST) X-Received: by 10.55.72.18 with SMTP id v18mr16636031qka.34.1449766358296; Thu, 10 Dec 2015 08:52:38 -0800 (PST) Received: from [192.168.0.26] (97-124-162-152.hlrn.qwest.net. [97.124.162.152]) by smtp.gmail.com with ESMTPSA id y95sm6340751qgd.27.2015.12.10.08.52.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Dec 2015 08:52:37 -0800 (PST) Message-ID: <5669ADD3.5000705@gmail.com> Date: Thu, 10 Dec 2015 16:52:00 -0000 From: Martin Sebor User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Bernd Schmidt , Gcc Patch List Subject: Re: [PATCH] update -Wall and -Wextra documentation References: <5668B417.8070604@gmail.com> <566968C1.9020302@redhat.com> In-Reply-To: <566968C1.9020302@redhat.com> Content-Type: multipart/mixed; boundary="------------050703090500060406020808" X-IsSubscribed: yes X-SW-Source: 2015-12/txt/msg01158.txt.bz2 This is a multi-part message in MIME format. --------------050703090500060406020808 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1976 On 12/10/2015 04:57 AM, Bernd Schmidt wrote: > On 12/10/2015 12:07 AM, Martin Sebor wrote: >> >> * invoke.texi (Warning Options): Update -Wall options. Clarify >> when some -Wextra options are enabled. Add -Wplacement-new example. > > I tried to check this list against c.opt - I figure this should contain > essentially the ones that are have an EnabledBy(Wall), plus whatever > logic there is in c-opts. Thanks for double-checking me! FWIW, I did something similar. I also verified those I wasn't sure about them using simple examples, but it's possible I overlooked something. > >> +-Wduplicated-cond @gol > > I don't see this one as enabled by Wall, and Yes, this one should not be there. I removed it in the updated patch. (Note the first patch didn't add it, just moved it up the list). Incidentally, testing this using the example from the manual triggers an ICE. I raised c/68839 for the record and closed it as a duplicate of c/68473. > >> +-Wplacement-new @r{(only for C++)} @gol > > This one appears to be on by default? Hmm. You're right, it is. I'm not sure that's what we want but let me confirm that with Jason and deal with it separately. I've corrected the patch to reflect the status quo. > >> +In C++, this warning is also enabled by @option{-Wall}. In C, it is >> also >> +enabled by @option{-Wextra}; to get the other warnings of >> @option{-Wextra} >> +without this warning, use @option{-Wextra -Wno-sign-compare}. > > Is the last part of the sentence really necessary? It kind of follows > from the rest of the documentation and we don't spell this out for other > -Wextra options. I don't think explaining how to turn the option off is necessary or adds any value but the text was already there and I didn't want to make gratuitous changes unrelated to the main purpose of the patch. But if you think it's appropriate I'm fine with removing it and have done that in the updated patch. The updated patch is attached. Martin --------------050703090500060406020808 Content-Type: text/x-patch; name="gcc-wall-doc.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="gcc-wall-doc.patch" Content-length: 3245 2015-12-09 Martin Sebor * invoke.texi (Warning Options): Update -Wall options. Clarify when some -Wextra options are enabled. Add -Wplacement-new example. Index: invoke.texi =================================================================== --- invoke.texi (revision 231525) +++ invoke.texi (working copy) @@ -3542,18 +3542,22 @@ @gccoptlist{-Waddress @gol -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol +-Wbool-compare @gol -Wc++11-compat -Wc++14-compat@gol -Wchar-subscripts @gol +-Wcomment @gol -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol +-Wformat @gol +-Wimplicit @r{(C and Objective-C only)} @gol -Wimplicit-int @r{(C and Objective-C only)} @gol -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol --Wbool-compare @gol --Wduplicated-cond @gol --Wcomment @gol --Wformat @gol +-Winit-self @r{(only for C++)} @gol +-Wlogical-not-parentheses -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol -Wmaybe-uninitialized @gol +-Wmemset-transposed-args @gol -Wmissing-braces @r{(only for C/ObjC)} @gol +-Wnarrowing @r{(only for C++)} @gol -Wnonnull @gol -Wopenmp-simd @gol -Wparentheses @gol @@ -3562,6 +3566,7 @@ -Wreturn-type @gol -Wsequence-point @gol -Wsign-compare @r{(only in C++)} @gol +-Wsizeof-pointer-memaccess @gol -Wstrict-aliasing @gol -Wstrict-overflow=1 @gol -Wswitch @gol @@ -3599,10 +3604,10 @@ -Wmissing-parameter-type @r{(C only)} @gol -Wold-style-declaration @r{(C only)} @gol -Woverride-init @gol --Wsign-compare @gol +-Wsign-compare @r{(C only)} @gol -Wtype-limits @gol -Wuninitialized @gol --Wshift-negative-value @gol +-Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol } @@ -4589,7 +4594,6 @@ if (p->q != NULL) @{ @dots{} @} else if (p->q != NULL) @{ @dots{} @} @end smallexample -This warning is enabled by @option{-Wall}. @item -Wframe-address @opindex Wno-frame-address @@ -4896,8 +4900,15 @@ @opindex Wno-placement-new Warn about placement new expressions with undefined behavior, such as constructing an object in a buffer that is smaller than the type of -the object. - +the object. For example, the placement new expression below is diagnosed +because it attempts to construct an array of 64 integers in a buffer only +64 bytes large. +@smallexample +char buf [64]; +new (buf) int[64]; +@end smallexample +This warning is enabled by default. + @item -Wpointer-arith @opindex Wpointer-arith @opindex Wno-pointer-arith @@ -5114,8 +5125,8 @@ @cindex signed and unsigned values, comparison warning Warn when a comparison between signed and unsigned values could produce an incorrect result when the signed value is converted to unsigned. -This warning is also enabled by @option{-Wextra}; to get the other warnings -of @option{-Wextra} without this warning, use @option{-Wextra -Wno-sign-compare}. +In C++, this warning is also enabled by @option{-Wall}. In C, it is +also enabled by @option{-Wextra}. @item -Wsign-conversion @opindex Wsign-conversion --------------050703090500060406020808--