From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by sourceware.org (Postfix) with ESMTPS id 3E68838346AF for ; Tue, 10 May 2022 08:21:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3E68838346AF Received: by mail-wr1-x429.google.com with SMTP id d5so22670976wrb.6 for ; Tue, 10 May 2022 01:21:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=1GX9fn97C2FsggKmpqe99z2oh4rgnkxZ88BleaRSOPE=; b=5RFKnM0eDnYbnd8EHjsUyo1njTyI3ktdRci5PkdXIt3fjupc1mP1JBez0m6NQW+IMn XT21/bfLYi+K8kahEoJIeULzwoC+gA3JLtC81J9GdH25Fq7aeCX8qTBtLfVQfRkMcLOS 2IGeNAWcvezQTiHRLKh9lej47KJ3mMoB2f4Jsljyq9ePJ8X+q7D0qF3T6swICFyhDanN b7N4vl88rwd1uO7S1FcgAQFkUK22KI9ECQEWNqs9D7EWAEqwk3ODwpt/Sk69uwPT5S8e IbWPNxlRN6QgBEofIQ29lFoHyOCdL+SaUc9WJ25JT84v3yocJi0ExMJ3uIz3iNmAvaH9 QnwA== X-Gm-Message-State: AOAM530D7d8zZKdvMsSkHG1qV0LltoZBNuUfXIT8nOaqhFTtigjBv4pA XO+QVTqisFUw5UdsWb//DXaE9VLRcjRkfw== X-Google-Smtp-Source: ABdhPJwufb3mGGbSdW6VEcF3iE/PiRQ21MTqw7fBYf5TpE/syhOwmer8vC+h0valyU2IxtZ3SXJHUg== X-Received: by 2002:a5d:6651:0:b0:20a:df2f:8027 with SMTP id f17-20020a5d6651000000b0020adf2f8027mr17510707wrw.269.1652170868707; Tue, 10 May 2022 01:21:08 -0700 (PDT) Received: from adacore.com ([45.147.211.82]) by smtp.gmail.com with ESMTPSA id bi6-20020a05600c3d8600b003942a244ebesm1728523wmb.3.2022.05.10.01.21.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 May 2022 01:21:08 -0700 (PDT) Date: Tue, 10 May 2022 08:21:07 +0000 From: Pierre-Marie de Rodat To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [Ada] Cleanup detection of No_Elist with No and Present Message-ID: <20220510082107.GA3029224@adacore.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="pWyiEgJYm5f9v55/" Content-Disposition: inline X-Spam-Status: No, score=-13.2 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.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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-List-Received-Date: Tue, 10 May 2022 08:21:11 -0000 --pWyiEgJYm5f9v55/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Replace equality and inequality operators with calls to No and Present. Offending occurrences found with: $ grep -n " /\?= No_Elist" *.adb Code cleanup only; semantics is unaffected. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_ch11.adb, exp_ch5.adb, exp_prag.adb, gnat_cuda.adb, sem_ch12.adb, sem_ch3.adb, sem_ch6.adb, sem_util.adb, treepr.adb: Replace /= and = operators with No and Present, respectively. --pWyiEgJYm5f9v55/ Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="patch.diff" diff --git a/gcc/ada/exp_ch11.adb b/gcc/ada/exp_ch11.adb --- a/gcc/ada/exp_ch11.adb +++ b/gcc/ada/exp_ch11.adb @@ -813,7 +813,7 @@ package body Exp_Ch11 is -- case we have to generate possible diagnostics. elsif Has_Local_Raise (Handler) - and then Local_Raise_Statements (Handler) /= No_Elist + and then Present (Local_Raise_Statements (Handler)) then Relmt := First_Elmt (Local_Raise_Statements (Handler)); while Present (Relmt) loop @@ -1528,7 +1528,7 @@ package body Exp_Ch11 is H := Find_Local_Handler (Entity (Name (N)), N); if Present (H) then - if Local_Raise_Statements (H) = No_Elist then + if No (Local_Raise_Statements (H)) then Set_Local_Raise_Statements (H, New_Elmt_List); end if; diff --git a/gcc/ada/exp_ch5.adb b/gcc/ada/exp_ch5.adb --- a/gcc/ada/exp_ch5.adb +++ b/gcc/ada/exp_ch5.adb @@ -2101,7 +2101,7 @@ package body Exp_Ch5 is -- from the Rhs by selected component because they are invisible -- in the type of the right-hand side. - if Stored_Constraint (R_Typ) /= No_Elist then + if Present (Stored_Constraint (R_Typ)) then declare Assign : Node_Id; Discr_Val : Elmt_Id; diff --git a/gcc/ada/exp_prag.adb b/gcc/ada/exp_prag.adb --- a/gcc/ada/exp_prag.adb +++ b/gcc/ada/exp_prag.adb @@ -1054,7 +1054,7 @@ package body Exp_Prag is Result : constant List_Id := New_List; Elmt : Elmt_Id; begin - if Elmts = No_Elist then + if No (Elmts) then return Result; end if; diff --git a/gcc/ada/gnat_cuda.adb b/gcc/ada/gnat_cuda.adb --- a/gcc/ada/gnat_cuda.adb +++ b/gcc/ada/gnat_cuda.adb @@ -149,7 +149,7 @@ package body GNAT_CUDA is is Device_Entities : Elist_Id := Get_CUDA_Device_Entities (Pack_Id); begin - if Device_Entities = No_Elist then + if No (Device_Entities) then Device_Entities := New_Elmt_List; Set_CUDA_Device_Entities (Pack_Id, Device_Entities); end if; @@ -166,7 +166,7 @@ package body GNAT_CUDA is is Kernels : Elist_Id := Get_CUDA_Kernels (Pack_Id); begin - if Kernels = No_Elist then + if No (Kernels) then Kernels := New_Elmt_List; Set_CUDA_Kernels (Pack_Id, Kernels); end if; @@ -687,7 +687,7 @@ package body GNAT_CUDA is -- Start of processing for Build_And_Insert_CUDA_Initialization begin - if CUDA_Node_List = No_Elist then + if No (CUDA_Node_List) then return; end if; @@ -745,7 +745,7 @@ package body GNAT_CUDA is begin pragma Assert (Debug_Flag_Underscore_C); - if Device_Entities = No_Elist then + if No (Device_Entities) then return; end if; @@ -789,7 +789,7 @@ package body GNAT_CUDA is E : Elist_Id) is begin - pragma Assert (Get_CUDA_Device_Entities (Pack_Id) = No_Elist); + pragma Assert (No (Get_CUDA_Device_Entities (Pack_Id))); CUDA_Device_Entities_Table.Set (Pack_Id, E); end Set_CUDA_Device_Entities; @@ -802,7 +802,7 @@ package body GNAT_CUDA is Kernels : Elist_Id) is begin - pragma Assert (Get_CUDA_Kernels (Pack_Id) = No_Elist); + pragma Assert (No (Get_CUDA_Kernels (Pack_Id))); CUDA_Kernels_Table.Set (Pack_Id, Kernels); end Set_CUDA_Kernels; diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -10224,7 +10224,7 @@ package body Sem_Ch12 is Prim : Node_Id; begin - if Prims_List /= No_Elist then + if Present (Prims_List) then Prim_Elmt := First_Elmt (Prims_List); while Present (Prim_Elmt) loop Prim := Node (Prim_Elmt); diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -5849,7 +5849,7 @@ package body Sem_Ch3 is -- Inherit Subprograms_For_Type from the full view, if present if Present (Full_View (T)) - and then Subprograms_For_Type (Full_View (T)) /= No_Elist + and then Present (Subprograms_For_Type (Full_View (T))) then Set_Subprograms_For_Type (Id, Subprograms_For_Type (Full_View (T))); diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -5473,11 +5473,11 @@ package body Sem_Ch6 is -- Restore the limited views in the spec, if any, to let the back end -- process it without running into circularities. - if Exch_Views /= No_Elist then + if Present (Exch_Views) then Restore_Limited_Views (Exch_Views); end if; - if Mask_Types /= No_Elist then + if Present (Mask_Types) then Unmask_Unfrozen_Types (Mask_Types); end if; diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -3414,7 +3414,7 @@ package body Sem_Util is end if; else - if Identifiers_List = No_Elist then + if No (Identifiers_List) then Identifiers_List := New_Elmt_List; end if; @@ -3438,7 +3438,7 @@ package body Sem_Util is Elmt : Elmt_Id; begin - if List = No_Elist then + if No (List) then return False; end if; @@ -3745,7 +3745,7 @@ package body Sem_Util is Collect_Identifiers (Comp_Expr); - if Writable_Actuals_List /= No_Elist then + if Present (Writable_Actuals_List) then -- As suggested by Robert, at current stage we -- report occurrences of this case as warnings. @@ -3908,7 +3908,7 @@ package body Sem_Util is -- Check violation of RM 6.20/3 in aggregates if Present (Aggr_Error_Node) - and then Writable_Actuals_List /= No_Elist + and then Present (Writable_Actuals_List) then Error_Msg_N ("value may be affected by call in other component because they " @@ -3919,8 +3919,8 @@ package body Sem_Util is -- Check if some writable argument of a function is referenced - if Writable_Actuals_List /= No_Elist - and then Identifiers_List /= No_Elist + if Present (Writable_Actuals_List) + and then Present (Identifiers_List) then declare Elmt_1 : Elmt_Id; diff --git a/gcc/ada/treepr.adb b/gcc/ada/treepr.adb --- a/gcc/ada/treepr.adb +++ b/gcc/ada/treepr.adb @@ -539,7 +539,7 @@ package body Treepr is return; end if; - if E = No_Elist then + if No (E) then Write_Str (""); elsif Is_Empty_Elmt_List (E) then --pWyiEgJYm5f9v55/--