From patchwork Mon Sep 5 07:25:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 969 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5044:0:0:0:0:0 with SMTP id h4csp57473wrt; Mon, 5 Sep 2022 00:31:45 -0700 (PDT) X-Google-Smtp-Source: AA6agR5PXoFiEo+7qb+GU9YdNR2ZGx6TvcJk/75ROnknHJ6L5zxyv7jI9iGIOXZu64R9yp+ePgoX X-Received: by 2002:a17:907:6293:b0:769:9dfc:10eb with SMTP id nd19-20020a170907629300b007699dfc10ebmr3378271ejc.191.1662363105187; Mon, 05 Sep 2022 00:31:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662363105; cv=none; d=google.com; s=arc-20160816; b=KtQGufdMa7Nk8zpwofVKBbN9MKENDd6aIndKaiGMtDmfgQ5v+E2NMIw5A3n1ElpexF Tf8liwgeFaFQUDywjlkQjQJKgtDu9gV5hlXTfM1DK2o1Rc/7riddwv+SHuE1BeTzFwcU mTCo3YTuZbgTclx3JcROoiFkrRT8cnjg8st9mrCcPnNYGGr4pqliU+tJxlFt7T60qnSx T7OH/lKEO+1+FNd7cuXk4G+eGQmk/NdL9r7hnPdTzWEaAxmF/asvuCPn5/GGTriaBq70 QciMs+kNDubPyxY5PtPE0iUJMnP3HKIPKpZDUCCJ8hovc9yWzQUCwo0BJiaF5x7y/hJp Gahw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-disposition:mime-version:message-id:subject:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=rI1ff7Y66K+Qa1yshwNW0nJeaUqGx2WYumamOQfVqTo=; b=u4+iul7lY9PeJmPaVYJKZtmmeCs1OduiP1pGGfgfhG1JwIlrrUANTYYHdEcoqNARrg 67yQP542pzdZVXr6Ep/RzjQU6ox25rk61UH8VjbzbRuUFfbvGCRmYKvXFkNXgIsxIbYp zbAr9EpgkTe28eE6rLE+vuPOpLIec1FTNEH2fIRDImcabfdmBv9lEbCW8UeV7cxYtLJL sPz3xZQz6V7jVRvHBlpP5K9DLtS8c5dDBDiWlHgUJItBFheqN3i76dTIx5oKN56s0gse El1cT3pd7yGDv+BgnG7Nf8YU7mDR63xSpCTV32PV7PoOzGaMWfstL88L/88hCoR/lZRX zv1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=lCI6GaiS; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id hu9-20020a170907a08900b00730672860bdsi6904395ejc.123.2022.09.05.00.31.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 00:31:45 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=lCI6GaiS; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 280B63887F56 for ; Mon, 5 Sep 2022 07:28:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 280B63887F56 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662362923; bh=rI1ff7Y66K+Qa1yshwNW0nJeaUqGx2WYumamOQfVqTo=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=lCI6GaiSB47GX8y/UJAd1LGwEDRyPU52R5xbtiyxorV59NDdC13IcGFcmHixasfcu j+xE6/3qXWb/15K84KIbxaLz9eg96RxGJsKOE2JzVgkE7dBHU2oKR25hiqfLSSpiHw MCH2Fe0UExJ8evaFktGWPPcUkGp3eqec15mWATcE= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by sourceware.org (Postfix) with ESMTPS id CF6543857036 for ; Mon, 5 Sep 2022 07:25:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CF6543857036 Received: by mail-wr1-x435.google.com with SMTP id w5so10049034wrn.12 for ; Mon, 05 Sep 2022 00:25:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date; bh=rI1ff7Y66K+Qa1yshwNW0nJeaUqGx2WYumamOQfVqTo=; b=cPzttcQTIvMXxj1piHcJQ2Ia9bSDW87QjJm/d5YtiBQSF35Zm7NTOxqQw5Gh4eBaAu H2mY3baPI+GmGhxBOR2vhg3OqSgEGk9a04MM6GDtww2h+sGv68b+elhRFH5OpXhiDT6O Rya684Tuh/d/CrFBZxpdisYTrP2skADfROOXKShRBHjWvBa4AzPimlhyEKmBZoSbETJg pptTScs98VV8O80OIlNHPgSb4l0NzzsCZmu/ubnsQg8BNAaghlCeGxREh8iY1SpKLFXF AkjyH7oko/qf5uzhAxvdd6+v2bYcLUPM+Bx57l2jpxG3iShYigJOQV4QNNKjXdIKZFZ2 plrQ== X-Gm-Message-State: ACgBeo2Nu8jqy3rjVhuGJE3D7mTdaWkOFEPL9u0ntyNnSIKdq8/dMDQ0 sNmIKoX3Qc4FXFMQPzWNSgY2n1KfLo/Dvw== X-Received: by 2002:adf:f909:0:b0:225:c35:8242 with SMTP id b9-20020adff909000000b002250c358242mr23105971wrr.550.1662362756780; Mon, 05 Sep 2022 00:25:56 -0700 (PDT) Received: from poulhies-Precision-5550 (static-176-191-105-132.ftth.abo.bbox.fr. [176.191.105.132]) by smtp.gmail.com with ESMTPSA id d14-20020a05600c34ce00b003a5f54e3bbbsm16578740wmq.38.2022.09.05.00.25.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 00:25:56 -0700 (PDT) Date: Mon, 5 Sep 2022 09:25:55 +0200 To: gcc-patches@gcc.gnu.org Subject: [Ada] New gnatbind switch -k Message-ID: <20220905072555.GA1174563@poulhies-Precision-5550> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: =?utf-8?q?Marc_Poulhi=C3=A8s_via_Gcc-patches?= From: =?utf-8?q?Marc_Poulhi=C3=A8s?= Reply-To: Marc =?iso-8859-1?q?Poulhi=E8s?= Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1743114054978741610?= X-GMAIL-MSGID: =?utf-8?q?1743114054978741610?= This switch can be used to disable the effect of -F when using -n explicitly or implicitly. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * bindgen.adb (Gen_Elab_Calls): Check for Check_Elaboration_Flags. * bindusg.adb (Display): Add -k. * opt.ads (Check_Elaboration_Flags): New. * switch-b.adb (Scan_Binder_Switches): Add processing of -k. * doc/gnat_ugn/building_executable_programs_with_gnat.rst: Add documentation for -k and -K. * gnat_ugn.texi: Regenerate. diff --git a/gcc/ada/bindgen.adb b/gcc/ada/bindgen.adb --- a/gcc/ada/bindgen.adb +++ b/gcc/ada/bindgen.adb @@ -1544,6 +1544,7 @@ package body Bindgen is Check_Elab_Flag := Units.Table (Unum_Spec).Set_Elab_Entity + and then Check_Elaboration_Flags and then not CodePeer_Mode and then (Force_Checking_Of_Elaboration_Flags or Interface_Library_Unit diff --git a/gcc/ada/bindusg.adb b/gcc/ada/bindusg.adb --- a/gcc/ada/bindusg.adb +++ b/gcc/ada/bindusg.adb @@ -156,6 +156,11 @@ package body Bindusg is (" -I- Don't look for sources & library files in default " & "directory"); + -- Line for -k switch + + Write_Line + (" -k Disable checking of elaboration flags"); + -- Line for -K switch Write_Line diff --git a/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst b/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst --- a/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst +++ b/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst @@ -6534,6 +6534,22 @@ be presented in subsequent sections. ALI file named in the ``gnatbind`` command line. + .. index:: -k (gnatbind) + +:switch:`-k` + Disable checking of elaboration flags. When using :switch:`-n` + either explicitly or implicitly, :switch:`-F` is also implied, + unless :switch:`-k` is used. This switch should be used with care + and you should ensure manually that elaboration routines are not called + twice unintentionally. + + + .. index:: -K (gnatbind) + +:switch:`-K` + Give list of linker options specified for link. + + .. index:: -l (gnatbind) :switch:`-l` diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -15724,6 +15724,22 @@ Do not look for sources in the current directory where @code{gnatbind} was invoked, and do not look for ALI files in the directory containing the ALI file named in the @code{gnatbind} command line. +@geindex -k (gnatbind) + +@item @code{-k} + +Disable checking of elaboration flags. When using @code{-n} +either explicitly or implicitly, @code{-F} is also implied, +unless @code{-k} is used. This switch should be used with care +and you should ensure manually that elaboration routines are not called +twice unintentionally. + +@geindex -K (gnatbind) + +@item @code{-K} + +Give list of linker options specified for link. + @geindex -l (gnatbind) @item @code{-l} @@ -29292,8 +29308,8 @@ to permit their use in free software. @printindex ge -@anchor{cf}@w{ } @anchor{gnat_ugn/gnat_utility_programs switches-related-to-project-files}@w{ } +@anchor{cf}@w{ } @c %**end of body @bye diff --git a/gcc/ada/opt.ads b/gcc/ada/opt.ads --- a/gcc/ada/opt.ads +++ b/gcc/ada/opt.ads @@ -267,6 +267,10 @@ package Opt is -- Set to True to detect whether subprogram parameters and function results -- alias the same object(s). + Check_Elaboration_Flags : Boolean := True; + -- GNATBIND + -- Set to False if switch -k is set. + Check_Float_Overflow : Boolean := False; -- GNAT -- Set to True to check that operations on predefined unconstrained float diff --git a/gcc/ada/switch-b.adb b/gcc/ada/switch-b.adb --- a/gcc/ada/switch-b.adb +++ b/gcc/ada/switch-b.adb @@ -379,6 +379,12 @@ package body Switch.B is Bad_Switch (Switch_Chars); end if; + -- Processing for k switch + + when 'k' => + Ptr := Ptr + 1; + Check_Elaboration_Flags := False; + -- Processing for K switch when 'K' =>