{"id":811591,"url":"http://patchwork.ozlabs.org/api/1.2/patches/811591/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/20170908133142.GA87409@adacore.com/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/1.2/projects/17/?format=json","name":"GNU Compiler Collection","link_name":"gcc","list_id":"gcc-patches.gcc.gnu.org","list_email":"gcc-patches@gcc.gnu.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170908133142.GA87409@adacore.com>","list_archive_url":null,"date":"2017-09-08T13:31:42","name":"[Ada] No room for new warning switches","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"e2a1f7dfe9819f1006333dca501e0263a9978926","submitter":{"id":4418,"url":"http://patchwork.ozlabs.org/api/1.2/people/4418/?format=json","name":"Arnaud Charlet","email":"charlet@adacore.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/20170908133142.GA87409@adacore.com/mbox/","series":[{"id":2211,"url":"http://patchwork.ozlabs.org/api/1.2/series/2211/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=2211","date":"2017-09-08T13:31:42","name":"[Ada] No room for new warning switches","version":1,"mbox":"http://patchwork.ozlabs.org/series/2211/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/811591/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/811591/checks/","tags":{},"related":[],"headers":{"Return-Path":"<gcc-patches-return-461726-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-461726-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"DY9haBt0\"; dkim-atps=neutral","sourceware.org; auth=none"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xpdXy5wNtz9s7p\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri,  8 Sep 2017 23:32:34 +1000 (AEST)","(qmail 9301 invoked by alias); 8 Sep 2017 13:31:45 -0000","(qmail 9199 invoked by uid 89); 8 Sep 2017 13:31:45 -0000","from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by\n\tsourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tFri, 08 Sep 2017 13:31:43 +0000","from localhost (localhost.localdomain [127.0.0.1])\tby\n\tfiltered-rock.gnat.com (Postfix) with ESMTP id 305285628A;\n\tFri,  8 Sep 2017 09:31:42 -0400 (EDT)","from rock.gnat.com ([127.0.0.1])\tby localhost (rock.gnat.com\n\t[127.0.0.1]) (amavisd-new, port 10024)\twith LMTP id\n\tHdy0me3TO8bn; Fri,  8 Sep 2017 09:31:42 -0400 (EDT)","from tron.gnat.com (tron.gnat.com [205.232.38.10])\tby\n\trock.gnat.com (Postfix) with ESMTP id 1FFDA56285;\n\tFri,  8 Sep 2017 09:31:42 -0400 (EDT)","by tron.gnat.com (Postfix, from userid 4192)\tid 1EF974A4;\n\tFri,  8 Sep 2017 09:31:42 -0400 (EDT)"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:cc:subject:message-id:mime-version:content-type; q=dns;\n\ts=default; b=Cdpx0E3jBSAMpQ9lLAXZtUMs03+xFZ7EEAVY3A8A0HYDg75q4X\n\ty1fkeN1u1q4x2kTgV7nIF7WNWnzub99qZHjusbJuGny+9GxSCdNpE4+dHF7tJn2r\n\t0uKhSAgKmnuOKlbKd/NrQxHUPjGY8nxAxilJz2eYauVZQulOCjIckNPFc=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:cc:subject:message-id:mime-version:content-type; s=\n\tdefault; bh=hgtnsgxA8p8ILixny3obCnxhKfw=; b=DY9haBt0bjX8ZHPkOau9\n\tp0OHRD/HjLYHCA03U2i2ArJieCB4j8qF5GSb6+R95nbBslYh0hOBmgk86jW8k/6s\n\tUJevJ6x4BFNMCgF7z2IzkQ/1MehFTibWO4b0X1VLKevMyshImHMks9Wn5TZll3Rx\n\t+hkDgw2juK/hQPeinL95/zs=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-10.5 required=5.0 tests=AWL, BAYES_00,\n\tGIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS,\n\tRCVD_IN_DNSWL_NONE,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:2800,\n\tjustin","X-HELO":"rock.gnat.com","Date":"Fri, 8 Sep 2017 09:31:42 -0400","From":"Arnaud Charlet <charlet@adacore.com>","To":"gcc-patches@gcc.gnu.org","Cc":"Justin Squirek <squirek@adacore.com>","Subject":"[Ada] No room for new warning switches","Message-ID":"<20170908133142.GA87409@adacore.com>","MIME-Version":"1.0","Content-Type":"multipart/mixed; boundary=\"jI8keyz6grp/JLjh\"","Content-Disposition":"inline","User-Agent":"Mutt/1.5.23 (2014-03-12)"},"content":"This patch adds machinary to create new warning flags using the underscore\n\"_\" prefix. This is necessary because all letters of the alphabet and letters\nprefixed with a dot \".\" are used already.\n\nTested on x86_64-pc-linux-gnu, committed on trunk\n\n2017-09-08  Justin Squirek  <squirek@adacore.com>\n\n\t* switch-c.adb (Scan_Front_End_Switches): Add new warning switch\n\tcase to handle underscore flags.\n\t* warnsw.adb, warnsw.ads (Set_Underscore_Warning_Switch): Create\n\tnew procedure to handle underscores.","diff":"Index: switch-c.adb\n===================================================================\n--- switch-c.adb\t(revision 251892)\n+++ switch-c.adb\t(working copy)\n@@ -1268,8 +1268,20 @@\n                         Bad_Switch (\"-gnatw.\" & Switch_Chars (Ptr .. Max));\n                      end if;\n \n-                     --  Normal case, no dot\n+                  --  Case of underscore switch\n \n+                  elsif C = '_' and then Ptr < Max then\n+                     Ptr := Ptr + 1;\n+                     C := Switch_Chars (Ptr);\n+\n+                     if Set_Underscore_Warning_Switch (C) then\n+                        Store_Compilation_Switch (\"-gnatw_\" & C);\n+                     else\n+                        Bad_Switch (\"-gnatw_\" & Switch_Chars (Ptr .. Max));\n+                     end if;\n+\n+                  --  Normal case, no dot\n+\n                   else\n                      if Set_Warning_Switch (C) then\n                         Store_Compilation_Switch (\"-gnatw\" & C);\nIndex: warnsw.adb\n===================================================================\n--- warnsw.adb\t(revision 251892)\n+++ warnsw.adb\t(working copy)\n@@ -471,6 +471,24 @@\n       return True;\n    end Set_Dot_Warning_Switch;\n \n+   -----------------------------------\n+   -- Set_Underscore_Warning_Switch --\n+   -----------------------------------\n+\n+   function Set_Underscore_Warning_Switch (C : Character) return Boolean is\n+   begin\n+      case C is\n+         when others =>\n+            if Ignore_Unrecognized_VWY_Switches then\n+               Write_Line (\"unrecognized switch -gnatw_\" & C & \" ignored\");\n+            else\n+               return False;\n+            end if;\n+      end case;\n+\n+      return True;\n+   end Set_Underscore_Warning_Switch;\n+\n    ----------------------------\n    -- Set_GNAT_Mode_Warnings --\n    ----------------------------\nIndex: warnsw.ads\n===================================================================\n--- warnsw.ads\t(revision 251892)\n+++ warnsw.ads\t(working copy)\n@@ -147,6 +147,13 @@\n    --  the command line or .C in a string literal in pragma Warnings. Returns\n    --  True for valid warning character C, False for invalid character.\n \n+   function Set_Underscore_Warning_Switch (C : Character) return Boolean;\n+   --  This function sets the warning switch or switches corresponding to the\n+   --  given character preceded by an underscore. Used to process a -gnatw_\n+   --  switch on the command line or _C in a string literal in pragma Warnings.\n+   --  Returns True for valid warnings character C, False for invalid\n+   --  character.\n+\n    procedure Set_GNAT_Mode_Warnings;\n    --  This is called in -gnatg mode to set the warnings for gnat mode. It is\n    --  also used to set the proper warning statuses for -gnatw.g. Note that\n","prefixes":["Ada"]}