From patchwork Mon Nov 4 16:11:05 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: 2006325 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=aiHGkAkQ; 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 4XhxWW0FZgz1xyJ for ; Tue, 5 Nov 2024 03:19:50 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 201073857704 for ; Mon, 4 Nov 2024 16:19:48 +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 79ACF3857BA5 for ; Mon, 4 Nov 2024 16:11:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 79ACF3857BA5 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 79ACF3857BA5 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=1730736744; cv=none; b=JG3G2aDGI5yjXOZnEhTodF5XaXGU45ksgIXzrvDMOnAlx8bfk2y6alFey64weALPGoQpybae8ijTMHXB4khrtQQyFWyvYjr07tvgBtylBWDse+8kiXV0Qsb2KW1M7aSehMsxM+ceHkS6Ywcu5PgBuN+UtMMFyHpC4GkJQ6KxlPI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1730736744; c=relaxed/simple; bh=p4jlVIlL9lor+rIzEkxMSz2ma6bQqwH0Ez5m/xdtV7o=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=JEeqxcZIaLsRhMdzDFYhVW35uHe6PCqit4v8jCdV8AEOteyp3kQ6xZW//hVz4JOJBIs2i8Yo7/CMtsdPVTvDWXF2HpntpF2UTc8c5GfxzkTS//MJvx3dusNd2UuBe44hlMZREk4TWB1jtW4mcV2wForMjZbBxSpmtSAJBjWaBKE= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-4315baa51d8so39147525e9.0 for ; Mon, 04 Nov 2024 08:11:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1730736710; x=1731341510; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0fgxZVqPBUchKr9N7rME3zvvAEEsrJ07mqwNDokivPU=; b=aiHGkAkQLjFmsbG9EJ0AlMXhHRTtwrwEmmWZxQWR/a4dwft4BdGd0ev9Jh88nV6lCN MVY/9lE5ddcSC1LLc58Uev/aAt3oeThxZqeadtU4kZUwfNFn+Ulsni/xElimqIxRBmzh IX4mWpaBWUXLH7xiFCXRdYkV4AFq25oYn/IW3ob5EolaojlUn70HTnmVCsfYhyuOeIN1 rLMsSlJ4pRdVVJaEBdkZyR5Vd1tgj2HOcDndi/L3g9QxtL0Afbqili6/F9jo+9rWhe45 pNGN2EJUxsgLL53ZeJlmNACwXik4PHUZzrZjn94HYxBWfjI/pJD0ry0sTJdwwnouXMLQ C2vQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730736710; x=1731341510; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0fgxZVqPBUchKr9N7rME3zvvAEEsrJ07mqwNDokivPU=; b=WQ1cl6iMurFuon14zUBsPcF8xGxxPOhrRef0IArLqR9WPmQ6i7Yy4tH+6Md9ACcz/3 JoZVZam0T4GZow6vvhnhZOOZ4JJAQIZEgqed7AbxOiwxr9OMO2qGwwCG+kKUPtEfM/HH SEPR8CnEShe0ET/PrrngQWSrgg2OGlCcY0SkQ9hviYdHXtwdN624BUM/w4XvrPybrLE6 X9cJwEYsq++Dje7NhMptp04S8zkmt9QrhXTvjHlkHieO80i4M43gEdC7L8Z8nu1ouwvW 0lzMMn/pwz+4hJKheBPurIyvFZlugmmynsBn0Qvh/JXWPxXl8SQYFBFaFdtW7YGPHod+ ofzw== X-Gm-Message-State: AOJu0YyAR4ishG3sLeRTp+HDVn2Ty4VsEgN7UniiC2FIUYK50hwKODYv 03furg4zfIZFueEZxwtHEstT2I84mhkzNibYCYK61SYZcVH5Co+4XoGVcQH8Gt3zIL1lt6BEi58 = X-Google-Smtp-Source: AGHT+IEcSxm6u5NSRkl1fB5JgXkYHT3/68PWMq5sIaKIdFX6UJFapMEsaxp3XOP54x26e2Ic/nUq2w== X-Received: by 2002:a05:600c:1c93:b0:42c:b9c7:f54b with SMTP id 5b1f17b1804b1-4327b70150fmr133349425e9.16.1730736710127; Mon, 04 Nov 2024 08:11:50 -0800 (PST) Received: from poulhies-Precision-5550.telnowedge.local (lmontsouris-659-1-24-67.w81-250.abo.wanadoo.fr. [81.250.175.67]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381c10e747csm13574463f8f.64.2024.11.04.08.11.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Nov 2024 08:11:49 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Viljar Indus Subject: [COMMITTED 30/38] ada: Avoid unused with warning with Extend_System Date: Mon, 4 Nov 2024 17:11:05 +0100 Message-ID: <20241104161116.1431659-30-poulhies@adacore.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241104161116.1431659-1-poulhies@adacore.com> References: <20241104161116.1431659-1-poulhies@adacore.com> MIME-Version: 1.0 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: Viljar Indus When the Extend_System pragma is used then we are supposed to check the extended system for referenced entities. Otherwise we would get an incorrect unused with warning. This was previously done on body files but it should also be done specs as well. gcc/ada/ChangeLog: * sem_warn.adb (Check_One_Unit): When a system extension is present always check entities from that unit before marking the unit unreferenced. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_warn.adb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb index 69e60be2966..2ffd631d628 100644 --- a/gcc/ada/sem_warn.adb +++ b/gcc/ada/sem_warn.adb @@ -2583,14 +2583,17 @@ package body Sem_Warn is if No (Ent) then + -- Check entities in the extended system if + -- specified. + + if Check_System_Aux (Lunit) then + null; + -- If in spec, just set the flag - if Unit = Spec_Unit then + elsif Unit = Spec_Unit then Set_No_Entities_Ref_In_Spec (Item); - elsif Check_System_Aux (Lunit) then - null; - -- Else the warning may be needed else