From patchwork Wed Feb 6 10:01:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 218521 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 3E0F42C02C1 for ; Wed, 6 Feb 2013 21:01:46 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1360749706; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Date:From:To:Cc:Subject:Message-ID: MIME-Version:Content-Type:Content-Disposition:User-Agent: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=910AXDpe0n0aZpjscM1S V/cRZBw=; b=oz/R+t9Q6gfS1fMW9R2+VbD8RfaSvRgAztbUp2D3626+UtMGlBo1 214oq3RxJusE4S/NeScC+lFyI8PsfRYE+a04napiG12NJgrhJPXGhn/3jekvlm5x IyEOJnQvF7q2+MEAar5AYupniLD38KbbMh6T89LWDrpXw02wJX1yVnI= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type:Content-Disposition:User-Agent:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=WYdkh3/5YHlwkT3fUUwFK7tbr9I2GNEO3ylYfTFrGf9yf4beuGpu7ZZVJzVzMD boefPLAK/at1zPwyLflDv/nuPQMGhD8lDzedFIZTf2mGoByWpbQAhOItf+9qsN3M XKfKjFig5TJYCOAFgaO3wy2Azdl4r2YSYmTbjcRgQoIDM=; Received: (qmail 7167 invoked by alias); 6 Feb 2013 10:01:27 -0000 Received: (qmail 7113 invoked by uid 22791); 6 Feb 2013 10:01:21 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_HOSTKARMA_NO X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 06 Feb 2013 10:01:03 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id D5CF82E612; Wed, 6 Feb 2013 05:01:02 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id hAhkNSIL4+Vo; Wed, 6 Feb 2013 05:01:02 -0500 (EST) Received: from kwai.gnat.com (kwai.gnat.com [205.232.38.4]) by rock.gnat.com (Postfix) with ESMTP id BE1FE2E5BF; Wed, 6 Feb 2013 05:01:02 -0500 (EST) Received: by kwai.gnat.com (Postfix, from userid 4192) id BAD053FF09; Wed, 6 Feb 2013 05:01:02 -0500 (EST) Date: Wed, 6 Feb 2013 05:01:02 -0500 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [Ada] Preliminary work to coordinate Pragma Warnings and middle-end warnings Message-ID: <20130206100102.GA13096@adacore.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org This couple of adjustments paves the way for the full coordination of Pragma Warnings with the warnings issued by the diagnostic engine of the middle-end. Tested on x86_64-pc-linux-gnu, committed on trunk 2013-02-06 Eric Botcazou * erroutc.adb (Validate_Specific_Warning): Do not issue the warning about an ineffective Pragma Warnings for -Wxxx warnings. * sem_prag.adb (Analyze_Pragma) : Accept -Wxxx warnings. * gnat_rm.texi (Pragma Warnings): Document coordination with warnings of the GCC back-end. Index: erroutc.adb =================================================================== --- erroutc.adb (revision 195784) +++ erroutc.adb (working copy) @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2013, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -1282,7 +1282,14 @@ Eproc.all ("?pragma Warnings Off with no matching Warnings On", SWE.Start); - elsif not SWE.Used then + + -- Do not issue this warning for -Wxxx messages since the + -- back-end doesn't report the information. + + elsif not SWE.Used + and then not (SWE.Msg'Length > 2 + and then SWE.Msg (1 .. 2) = "-W") + then Eproc.all ("?no warning suppressed by this pragma", SWE.Start); end if; Index: gnat_rm.texi =================================================================== --- gnat_rm.texi (revision 195784) +++ gnat_rm.texi (working copy) @@ -6154,6 +6154,14 @@ User's Guide}. @noindent +The warnings controlled by the `-gnatw' switch are generated by the front end +of the compiler. The `GCC' back end can provide additional warnings and they +are controlled by the `-W' switch. +The form with a single static_string_EXPRESSION argument also works for the +latters, but the string must be a single full `-W' switch in this case. +The above reference lists a few examples of these additional warnings. + +@noindent The specified warnings will be in effect until the end of the program or another pragma Warnings is encountered. The effect of the pragma is cumulative. Initially the set of warnings is the standard default set @@ -6173,6 +6181,12 @@ expression notations are permitted. All characters other than asterisk in these three specific cases are treated as literal characters in the match. +@noindent +The fourth form also works for the additional warnings of the `GCC' back end, +but the string must again be a single full `-W' switch in this case. Note that +the message issued for these warnings explicitly lists the full `-W' switch +they are associated with. + There are two ways to use the pragma in this form. The OFF form can be used as a configuration pragma. The effect is to suppress all warnings (if any) that match the pattern string throughout the compilation. Index: sem_prag.adb =================================================================== --- sem_prag.adb (revision 195784) +++ sem_prag.adb (working copy) @@ -16017,9 +16017,23 @@ if OK then Chr := Get_Character (C); + -- Dash case: only -Wxxx is accepted + + if J = 1 + and then J < Len + and then Chr = '-' + then + J := J + 1; + C := Get_String_Char (Str, J); + Chr := Get_Character (C); + if Chr = 'W' then + exit; + end if; + OK := False; + -- Dot case - if J < Len and then Chr = '.' then + elsif J < Len and then Chr = '.' then J := J + 1; C := Get_String_Char (Str, J); Chr := Get_Character (C);