From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26130 invoked by alias); 7 Aug 2014 17:10:54 -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 26113 invoked by uid 89); 7 Aug 2014 17:10:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 07 Aug 2014 17:10:50 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1XFRDC-0002lD-5U from joseph_myers@mentor.com ; Thu, 07 Aug 2014 10:10:46 -0700 Received: from SVR-IES-FEM-01.mgc.mentorg.com ([137.202.0.104]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 7 Aug 2014 10:10:46 -0700 Received: from digraph.polyomino.org.uk (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.2.247.3; Thu, 7 Aug 2014 18:10:44 +0100 Received: from jsm28 (helo=localhost) by digraph.polyomino.org.uk with local-esmtp (Exim 4.76) (envelope-from ) id 1XFRD9-00015h-8a; Thu, 07 Aug 2014 17:10:43 +0000 Date: Thu, 07 Aug 2014 17:10:00 -0000 From: "Joseph S. Myers" To: Marek Polacek CC: GCC Patches Subject: Re: [C PATCH] Implement -Wc90-c99-compat (PR c/51849) In-Reply-To: <20140731073921.GD30336@redhat.com> Message-ID: References: <20140731073921.GD30336@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-SW-Source: 2014-08/txt/msg00830.txt.bz2 On Thu, 31 Jul 2014, Marek Polacek wrote: > A few issues: currently we don't warn (in -std=c90 -pedantic mode) > about the usage of __func__ and _Pragma (possible others - va_copy?). > I'm hoping this is not that important though. For restrict/inline, > in GNU90 mode we just don't compile the code at all (unless we use > __restrict and similar), and -Wc90-c99-compat does not warn about those. And, -pedantic -Wno-c90-c99-compat - outside C99 mode - doesn't disable the relevant warnings (I'd think of it as logically like -pedantic -Wno-long-long, so it should disable them, while leaving all the -pedantic diagnostics for features that aren't in C99). Though I think implementing that could reasonably be a followup fix. E.g., in C90 mode, -Wlong-long is more specific than -Wc90-c99-compat, which is more specific than -pedantic. So the "long long" warnings should be determined by any explicit -W(no-)long-long if given, otherwise by any -W(no-)c90-c99-compat if given, otherwise by -pedantic, following the general rule of the most specific option taking precedence (and command-line order only being relevant when multiple variants of the same option are used, e.g. -Wlong-long -Wno-long-long). Outside C90 mode, -pedantic is irrelevant to such warnings; -W(no-)long-long should take precedence over -W(no-)c90-c99-compat if both are used. For warnings without a more specific option such as -Wlong-long, of course it's a bit simpler. > @@ -44,21 +44,38 @@ pedwarn_c99 (location_t location, int opt, const char *gmsgid, ...) > va_end (ap); > } > > -/* Issue an ISO C90 pedantic warning MSGID. This function is supposed to > - be used for matters that are allowed in ISO C99 but not supported in > - ISO C90, thus we explicitly don't pedwarn when C99 is specified. > - (There is no flag_c90.) */ > +/* Issue an ISO C90 pedantic warning MSGID if -pedantic outside C99 mode, > + otherwise issue warning MSGID if -Wc90-c99-compat is specified, or if > + specific option such as -Wlong-long is specified. "a specific option". OK with that change. -- Joseph S. Myers joseph@codesourcery.com