From patchwork Fri Jul 18 09:23:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 371378 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 21A2614012A for ; Fri, 18 Jul 2014 19:23:57 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=hJReqotRR6zYAbHcIguAkAeQKf88bUzVDkvR9i1zK2n4y45LXa 9wc3rCBZf++L3TmDdvr+315FNI4BcY1daAFcjdm1SNpcX1KHkycPmXpkYBSip2fh 2SkGSwOwv8R15E/RZFDZk7SMh93jwQKaeRqnBYhbzpRu2oYViB8Hwg/C8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=TKX+BYxKLbinlj56wrqTtJMOplI=; b=S4W5UdUtnMyDgIrmvbUU PxRWQOKRgVf+hSOcEn5X9VJVQzEYeaHbrp8ND4cqTDUG1iQXwAC+F1mfoMQoZB/F HUj6uMk/zDebNir8hmQ93xyTPvIqdn7yIFrI1Il1sMf6BBgLUR0MNEqbT7Qj7F9I aoN+XKXsemwghmj7sDe/8tc= Received: (qmail 28280 invoked by alias); 18 Jul 2014 09:23:49 -0000 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 Received: (qmail 28223 invoked by uid 89); 18 Jul 2014 09:23:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.3.2 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 18 Jul 2014 09:23:41 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id F05DD116269; Fri, 18 Jul 2014 05:23:39 -0400 (EDT) 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 JIKmOpq06mux; Fri, 18 Jul 2014 05:23:39 -0400 (EDT) Received: from kwai.gnat.com (kwai.gnat.com [IPv6:2620:20:4000:0:a6ba:dbff:fe26:1f63]) by rock.gnat.com (Postfix) with ESMTP id DEDE1116265; Fri, 18 Jul 2014 05:23:39 -0400 (EDT) Received: by kwai.gnat.com (Postfix, from userid 4192) id DBFAA3FE21; Fri, 18 Jul 2014 05:23:39 -0400 (EDT) Date: Fri, 18 Jul 2014 05:23:39 -0400 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Vincent Celier Subject: [Ada] Enforce style check for all binary operators Message-ID: <20140718092339.GA32320@adacore.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Add two missing style checks for token spacing for binary operators when switches -gnatyt, -gnatyy or -gnatyg is used. Preserve previous behavior with debug switch -gnatd.Q Test: $ gcc -c pkg.ads -gnatyt -gnatl -gnatd7 Compiling: pkg.ads 1. package Pkg is 2. One : constant := 1; 3. type Entier is range 0 .. 16-One; | >>> (style) space required 4. AB : constant String := "A"&"B"; | >>> (style) space required 5. end Pkg; 5 lines: No errors, 2 warnings Invoking gcc -c pkg.ads -gnatyt -gnatd.Q should not report any warning. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-07-18 Vincent Celier * par-ch4.adb (Simple_Expression): Add missing style check for binary adding operators. (Term): Add missing style check for multiplying operators. Index: debug.adb =================================================================== --- debug.adb (revision 212725) +++ debug.adb (working copy) @@ -134,7 +134,7 @@ -- d.N Add node to all entities -- d.O Dump internal SCO tables -- d.P Previous (non-optimized) handling of length comparisons - -- d.Q + -- d.Q Previous (incomplete) style check for binary operators -- d.R Restrictions in ali files in positional form -- d.S Force Optimize_Alignment (Space) -- d.T Force Optimize_Alignment (Time) Index: par-ch4.adb =================================================================== --- par-ch4.adb (revision 212656) +++ par-ch4.adb (working copy) @@ -2152,6 +2152,11 @@ exit when Token not in Token_Class_Binary_Addop; Tokptr := Token_Ptr; Node2 := New_Op_Node (P_Binary_Adding_Operator, Tokptr); + + if Style_Check and then not Debug_Flag_Dot_QQ then + Style.Check_Binary_Operator; + end if; + Scan; -- past operator Set_Left_Opnd (Node2, Node1); Node1 := P_Term; @@ -2406,6 +2411,11 @@ exit when Token not in Token_Class_Mulop; Tokptr := Token_Ptr; Node2 := New_Op_Node (P_Multiplying_Operator, Tokptr); + + if Style_Check and then not Debug_Flag_Dot_QQ then + Style.Check_Binary_Operator; + end if; + Scan; -- past operator Set_Left_Opnd (Node2, Node1); Set_Right_Opnd (Node2, P_Factor);