From patchwork Tue Nov 7 09:20:12 2023 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: 162343 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:aa0b:0:b0:403:3b70:6f57 with SMTP id k11csp112796vqo; Tue, 7 Nov 2023 01:24:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IGGK04En2e19eVDyqtp2xtxxiu0DQBgK1Mh0vLlJu+PoSgZ4UabpfUy6rQxjhzHcFpwoAQA X-Received: by 2002:a05:622a:2a81:b0:401:e2b1:d28d with SMTP id kf1-20020a05622a2a8100b00401e2b1d28dmr23888794qtb.20.1699349062206; Tue, 07 Nov 2023 01:24:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1699349062; cv=pass; d=google.com; s=arc-20160816; b=Dn7dO4H4jZqGwuhWkoOiYUcGh5lmrermFwj05vS4ifrCpCHyr6xLTnmwJperVOGpqz 98u12L2FUZiQdYO9f+f8koqLNrfbHOaKdmbrR4mCkemp2vcphXSNnZjAgRdT133aiAaR 8eICMxY5TU28UJltlYK5X02x1bNoFv6a6KwmBxAgfBGRCm+n9hlovyX88URFGcBS0yAN BDDUK0xwt2QzUmDEa+vfRfVfapAOw7+oxV+5h15Jtg8EwTD9Pnwc/maXvagebNndnIMy TvULSiC9nRYjdstg/CDEl61khkJX5foGG9TQrVQhakv7KPyPV7k1QbbswHoFDviwqc94 qz3Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=E8wWcwoU4ZaGA1/JVvoMVDXQAQ3I8l1dnpowey0gA2U=; fh=QRb7QY4BZ0mIIAPiH2G4K0PcYKRtRn2i5A6VLUA8cN4=; b=I6Bwac5dXCsLBrfMDXjMIvuEuY/FMfHHa0y/qM1Dsl4D+6Dy7MEloy6T1JM/qQ2x9r ZHPvhEIAD5qLEmEh7Kwsxle6D/FBsGxAcHB+I4nx1gxAHqnp/spl4lORTmgsWKyW4EAd SWBFL1dvDfI6Zx1a9COLqHkts1aK69T9aBdaHXWyKjNkuflS24++kmj+yy9iMGUBsURD GBY7+NWBVQno+gr3VuW6eT5DLARfBH1KDEyjl1jqnWgtxEuf5q5Y4fkbB3AvY5W/ZGCe GMuYExNZjFV2ky/DbjOsR5+8Tfq4w3DGjxbT0BETOwTIZyUkCHiIVK3/0GpDRobS82kH 4MyQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@adacore.com header.s=google header.b=X6nqGaUt; arc=pass (i=1); 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=adacore.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id o17-20020a05622a139100b004180965b3d6si7097069qtk.144.2023.11.07.01.24.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 01:24:22 -0800 (PST) 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=@adacore.com header.s=google header.b=X6nqGaUt; arc=pass (i=1); 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=adacore.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id ACC3F3861897 for ; Tue, 7 Nov 2023 09:23:14 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lj1-x233.google.com (mail-lj1-x233.google.com [IPv6:2a00:1450:4864:20::233]) by sourceware.org (Postfix) with ESMTPS id 714FB386483A for ; Tue, 7 Nov 2023 09:20:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 714FB386483A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 714FB386483A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::233 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699348818; cv=none; b=KsnKZQxMSNi3DKJaHOH6Nuu0u+unDYdpjdq/KNYg9hfTys2IgPsJmbr1877YJJp72xZ+WxTbfK6j0dWru/e93ux1XK3G1UKGzVVHqbIoIXu5i9261asc/3vzGyhiqH7tDgbucGQj7Uu9PRefhYKsMiJTSTu7IpS9WyQdNr/L1uI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699348818; c=relaxed/simple; bh=LJFik+hQ72X+EBHLa5L7hOqYSgKYVgfFtE/+8AXYauQ=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=C++YmrsZoUEQrHiA5aQwIB66YEVSVjOvf4dnrNLkUq+3QTZQpe1jziHniTJiBoALYPFVylceZQEg2FqR4aLHc+A2bKAnLn8TCdJtp+6bQDM66u09/BcVcdoaNQZL4SICjI1WxDizBqBvx2d7qQTge99YXOjv5WUBrRZbqjjFyF8= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2c514cbbe7eso76739341fa.1 for ; Tue, 07 Nov 2023 01:20:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1699348815; x=1699953615; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=E8wWcwoU4ZaGA1/JVvoMVDXQAQ3I8l1dnpowey0gA2U=; b=X6nqGaUtKERGsVWMRCbad1WQy/TrKo0l8SF/Ch8eT5uYajny5C5GB0D5QZpunpWLfU SRHPEYCIdW0eNBtdslz2G3Epv2HcpfxcmL3+K5PlSszdM2tC8T5eASyVRxk7VhBHC3ox d4RPUc29ZpO46DTga5ZJ3e5MKCXqL+aqViEHGnti7HHaO8CGyX0KXBh+YYwdkYyt0ac6 31oYlVb/bmmXxkbRDp2t9070yLmaC6XSZglnUE60KgQzB01w+mjNvPdXlIhtEsor0v3q c5VYQsVZSVuElzhYk14SYhXefpxxb4BFmGvNMXU9GHYP+ky5EtnntmL2E/ox+fGARCDe DscA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699348815; x=1699953615; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=E8wWcwoU4ZaGA1/JVvoMVDXQAQ3I8l1dnpowey0gA2U=; b=URF7gmQa6tx7SgXuuDJQGZeCjxGBMJ39VIfPBVqHBEMjZYO9e+2e7ZdE0Ww1exRJlw H96Qqhei3N/UACk2E0dg/EQzGS5VD+7jJGpKq+JNH5pwlWO/5yeQjw0DaA7uzZZjkGI3 Z5L2RaKwmn29ECwI/kNAl2X5BfblInVakXjwVD8YQBBn50JjC5W7/pLCRtNqCZs6nnL4 zBZbr/rCe2ImxSpgFZTDBpvTqNtcsvvJHe0dYf3Y0QUT5IkaggrVTrzwypIITIqrViOP Sctze2IFXZ2snwXXSB9iroJkQnn6PDfRIddWfySrSmL74KMGBvcUZa9RVw+LS+psMJgs JEbQ== X-Gm-Message-State: AOJu0Yw9LgxMCZh+KR7hwt0/yyiip+rKt9r8QrUmAD6GHbQ3rdX9rvfy UR0SD36L8H/ordoOGJVUGAJ8UAKUBLNKuc5QrnUtdw== X-Received: by 2002:a2e:86c3:0:b0:2c5:94a:ac96 with SMTP id n3-20020a2e86c3000000b002c5094aac96mr26867323ljj.9.1699348814856; Tue, 07 Nov 2023 01:20:14 -0800 (PST) Received: from localhost.localdomain ([2001:861:3382:1a90:dbc1:a1d1:2e58:4040]) by smtp.gmail.com with ESMTPSA id p22-20020a05600c419600b00401d8181f8bsm14537750wmh.25.2023.11.07.01.20.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 01:20:14 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED] ada: Cleanup more "not Present" Date: Tue, 7 Nov 2023 10:20:12 +0100 Message-ID: <20231107092012.3906244-1-poulhies@adacore.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 X-Spam-Status: No, score=-13.7 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781896642395179724 X-GMAIL-MSGID: 1781896642395179724 From: Piotr Trojanek We had a GNATcheck rule that suggests replacing "not Present (...)" with "No (...)", but it only detected calls with a parameter of type Node_Id. Now this rules also detects parameters of type Elist_Id. gcc/ada/ * sem_ch3.adb, sem_ch4.adb, sem_eval.adb: Fix newly detected violations. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_ch3.adb | 12 +++++------- gcc/ada/sem_ch4.adb | 2 +- gcc/ada/sem_eval.adb | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index e92b46fa6f6..c1113e4fc42 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -3385,7 +3385,7 @@ package body Sem_Ch3 is -- case we bypass this. if Ekind (T) /= E_Void then - if not Present (Direct_Primitive_Operations (T)) then + if No (Direct_Primitive_Operations (T)) then if Etype (T) = T then Set_Direct_Primitive_Operations (T, New_Elmt_List); @@ -3397,8 +3397,7 @@ package body Sem_Ch3 is elsif Etype (T) = Base_Type (T) then - if not Present (Direct_Primitive_Operations (Base_Type (T))) - then + if No (Direct_Primitive_Operations (Base_Type (T))) then Set_Direct_Primitive_Operations (Base_Type (T), New_Elmt_List); end if; @@ -3416,7 +3415,7 @@ package body Sem_Ch3 is -- If T already has a Direct_Primitive_Operations list but its -- base type doesn't then set the base type's list to T's list. - elsif not Present (Direct_Primitive_Operations (Base_Type (T))) then + elsif No (Direct_Primitive_Operations (Base_Type (T))) then Set_Direct_Primitive_Operations (Base_Type (T), Direct_Primitive_Operations (T)); end if; @@ -10345,7 +10344,7 @@ package body Sem_Ch3 is -- If not already set, initialize the derived type's list of primitive -- operations to an empty element list. - if not Present (Direct_Primitive_Operations (Derived_Type)) then + if No (Direct_Primitive_Operations (Derived_Type)) then Set_Direct_Primitive_Operations (Derived_Type, New_Elmt_List); -- If Etype of the derived type is the base type (as opposed to @@ -10355,8 +10354,7 @@ package body Sem_Ch3 is -- between the two. if Etype (Derived_Type) = Base_Type (Derived_Type) - and then - not Present (Direct_Primitive_Operations (Etype (Derived_Type))) + and then No (Direct_Primitive_Operations (Etype (Derived_Type))) then Set_Direct_Primitive_Operations (Etype (Derived_Type), diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb index 2f3dfe71590..e3badc3e19d 100644 --- a/gcc/ada/sem_ch4.adb +++ b/gcc/ada/sem_ch4.adb @@ -9911,7 +9911,7 @@ package body Sem_Ch4 is if (not Is_Tagged_Type (Obj_Type) and then (not (Core_Extensions_Allowed or Allow_Extensions) - or else not Present (Primitive_Operations (Obj_Type)))) + or else No (Primitive_Operations (Obj_Type)))) or else Is_Incomplete_Type (Obj_Type) then Obj_Type := Prev_Obj_Type; diff --git a/gcc/ada/sem_eval.adb b/gcc/ada/sem_eval.adb index f744ab38be6..f88a00aa380 100644 --- a/gcc/ada/sem_eval.adb +++ b/gcc/ada/sem_eval.adb @@ -6812,7 +6812,7 @@ package body Sem_Eval is -- No constraint on the parent type - or else not Present (Discriminant_Constraint (Etype (Typ))) + or else No (Discriminant_Constraint (Etype (Typ))) or else Is_Empty_Elmt_List (Discriminant_Constraint (Etype (Typ)))