From patchwork Mon May 6 09:18:07 2024 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: 1931858 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=VYvWt1Zh; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VXwtp4lWxz1xnT for ; Mon, 6 May 2024 19:23:14 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C3BB93864C15 for ; Mon, 6 May 2024 09:23:12 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by sourceware.org (Postfix) with ESMTPS id 46499384B06A for ; Mon, 6 May 2024 09:18:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 46499384B06A Authentication-Results: sourceware.org; dmarc=pass (p=quarantine 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 46499384B06A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::32f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714987095; cv=none; b=WFwkpeizEFvPmiAACY0I1fY/Gmwia4R8nW/FznaCbVXdXgJqoTPTJO2OTSbyecBf75owgkoK4kJEFdEQu0oVr6xJfmWvPNL+OR98EvJJ9NRKlCCdfyBNzVJu92PJxZuCtvpVeRAQs6g5iqOCoEKcpHo1ziv0zPlMlov0pB61NM0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714987095; c=relaxed/simple; bh=XnTdWRJNGhLQundAbxzaH5C4somOwko4DVcEzokb6gk=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=UGMndM2II1k0VzJj3/NH1IWI86uFLZW9mc+7GkjcxC4fMnSWJbEBbI/ZBMfLOwdIwFwC6+ewks/CyMb3wZnun1bQFHZ/XBuffGPDHcRiX6mt6VgbbcTGMavDw07phixeFrzzjLMDs+GMkqHcov2rnFngUOdfPAZyTRgI5ZKjG14= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-41a72f3a20dso11161385e9.0 for ; Mon, 06 May 2024 02:18:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1714987092; x=1715591892; 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=HHNtQORaU2+1NfGmx2FxOpki1DTarjm9f6RRWP6AFaU=; b=VYvWt1Zh7/qWmCLg2QiCU0fh0kwMKBdXetB34wJfUF/ctkfEeYNsudhSgsBLtBdv5Q x9PM8v5eTHHRfp2WeCmr/PLRh4xHYSz4MEOy4ZqC62s0MnBf9IQRG//GEFx8apvsqcv8 N0KApIHIN+nhhtQQba53qIpgrHspmVSqFzu3x2pGVV9+aqR9MspHJbNUYKwLnaujvP5K mFn+8MCyVwuEiAXYBOIJJgcVUIb7LfvjKv0HZ1SLCPZaj17m+7CxtefXwaNDyKkn91H+ N3StxQicCBgodkSRFqJohtMegYaD75lxS9poUqldp5pb654cpAPV1OjWiTGU6JT1/F9c /I4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714987092; x=1715591892; 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=HHNtQORaU2+1NfGmx2FxOpki1DTarjm9f6RRWP6AFaU=; b=wgXeEQztdJJPHdr1Js7qZfUg2c6UATRknNsV01f5kXxG5vVU0N2KUoXK3aRAK019bc UjSpQaBHf+kulVIE2B/cLRBAVbCbYWGVrNNKuzooIxwqQulUcsq1DmUF74f3sgcawyCv qR8x9xepBJG9pLRp3qw/w265kkA4+omf5Z3ZUHFQFZgDhK8LWgUxP32sulcQXw3an7xJ zXL0zGF8+bteGWgeDGigNJ0tw/hhKAhHL7UybcwSmKL8QcplNkARpZ754WJouvunyFz9 HiPuTX5CsFl74c1F2150zL06kbTuqkNDZQSNm50CSRe82NKzGa8VuHlRQ17UbTPWoylM dnkg== X-Gm-Message-State: AOJu0YwcEt8W5Z2GnI6jVzMt0I4iBNoIPayzSL/zDKKH2baOwF22OGhz gnWtu75o25jruRbi6ryJ1GQqoJC5WT9zs42TImxrPf1eK50zfn4FEl9AzXaf+mvSsYJ49kq+oW0 = X-Google-Smtp-Source: AGHT+IGIh/I4k8NyJDbRAKfDwvKqvjAV2kqt/AjdEyyJHNvPzCTiRfJsFJWV3DJ9w0nysmqOWUzxdw== X-Received: by 2002:a05:600c:358a:b0:41e:454b:2f7 with SMTP id p10-20020a05600c358a00b0041e454b02f7mr5105114wmq.23.1714987092147; Mon, 06 May 2024 02:18:12 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:9ea2:39d7:df74:396d]) by smtp.gmail.com with ESMTPSA id m18-20020adfa3d2000000b0034dfede0071sm10275687wrb.46.2024.05.06.02.18.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 02:18:11 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED] ada: Replace redundant conditions with assertions Date: Mon, 6 May 2024 11:18:07 +0200 Message-ID: <20240506091807.1585450-1-poulhies@adacore.com> X-Mailer: git-send-email 2.43.2 MIME-Version: 1.0 X-Spam-Status: No, score=-13.6 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 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+incoming=patchwork.ozlabs.org@gcc.gnu.org From: Piotr Trojanek Fix warnings from the CodePeer. The code structure is essentially: if A and B then ... elsif not A and not B then ... elsif A then ... elsif B then ... -- this condition is redundant end if; and it causes CodePeer to say "exception is raised in a conditional branch", which most likely means that the condition is redundant. gcc/ada/ * make.adb (Scan_Make_Arg): Remove redundant condition. * switch-b.adb (Scan_Debug_Switches): Likewise. * switch-c.adb (Scan_Front_End_Switches): Likewise. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/make.adb | 2 +- gcc/ada/switch-b.adb | 2 +- gcc/ada/switch-c.adb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gcc/ada/make.adb b/gcc/ada/make.adb index 01d3ccab8af..24b2d099bfe 100644 --- a/gcc/ada/make.adb +++ b/gcc/ada/make.adb @@ -4508,7 +4508,7 @@ package body Make is Make_Failed ("RTS path not valid: missing adainclude directory"); - elsif Lib_Path_Name = null then + else pragma Assert (Lib_Path_Name = null); Make_Failed ("RTS path not valid: missing adalib directory"); end if; diff --git a/gcc/ada/switch-b.adb b/gcc/ada/switch-b.adb index 2c4fc0c6039..8d8dc58937c 100644 --- a/gcc/ada/switch-b.adb +++ b/gcc/ada/switch-b.adb @@ -703,7 +703,7 @@ package body Switch.B is elsif Src_Path_Name = null then Osint.Fail ("RTS path not valid: missing adainclude directory"); - elsif Lib_Path_Name = null then + else pragma Assert (Lib_Path_Name = null); Osint.Fail ("RTS path not valid: missing adalib directory"); end if; diff --git a/gcc/ada/switch-c.adb b/gcc/ada/switch-c.adb index 7668fce885a..43b69f1dde1 100644 --- a/gcc/ada/switch-c.adb +++ b/gcc/ada/switch-c.adb @@ -274,7 +274,7 @@ package body Switch.C is Osint.Fail ("RTS path not valid: missing " & "adainclude directory"); - elsif RTS_Lib_Path_Name = null then + else pragma Assert (RTS_Lib_Path_Name = null); Osint.Fail ("RTS path not valid: missing " & "adalib directory"); end if;