From patchwork Tue Nov 7 09:19: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: 162328 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:aa0b:0:b0:403:3b70:6f57 with SMTP id k11csp111326vqo; Tue, 7 Nov 2023 01:20:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IGAEY0C/FkJxGAKI9FKgjA/Yv9ZPyRKz1gJHTld1NvMc9F3JX8aucCZJjtROhsVTIzrr0iw X-Received: by 2002:a05:620a:25d3:b0:77a:1cc0:6e5f with SMTP id y19-20020a05620a25d300b0077a1cc06e5fmr30027907qko.18.1699348815746; Tue, 07 Nov 2023 01:20:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1699348815; cv=pass; d=google.com; s=arc-20160816; b=YraVb9IHljDGGhlUZyvNKPAy7oOiuyZZmnVp0x+PjbPW0/xYGBS/IqKV0a0DaJDXiZ /X56bOS4sFMBzXLSKT+VD97qLdt6g64U66dlbBkqWPGOzdjLL9sFejexgNEvKzv4iKRm +FXZinPY32LnUd1yFmyfXwiN+S7TnreCSkLDVKnHbWqpa/bkGFBo2FrzZBzZknfxXqSr MfqDSOLrFI/d6PACNV8BaxRRS4yWu5zspjatqWaok3M3JS3XXLaxMgOhsjdhK7se/Vv/ JcMoRPpbY0vh6koZNOpmVM+Tlitj1Ag+mk6MQ06Eme7U1Z70mdrcKoaSvbmXMPFx9maB 6JTQ== 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=K/G1Dd7hi4VhsWoIso0EhDJx8g6dRUkPemMK3HZ8AyU=; fh=V3FUX71dhq7uYqp2NU3QsSvdKCASDvtMIqKaZekiAR8=; b=FVsdG3RjEYA6N46ea45tCMlWW8Q/c03aji/EVAAbfpxVKLaAhRSy1W57PAFR0EQMpp SvKX6SkaKsqKWIXy9T8jaLO2tEDFjmQ+/JxmtQ7GuPw1fY73YK/UOw40uzGh/vC1bMxu n4rt9Pa51amEOM9hhPudHE7olNbntwZyw2IXtPnrVJlLm2uIT7smyCxYaHbNGkxim0DM FYDiGIGa7N49cFkXk7ypzw38fFLvobDYRNqxKfZB+dr28oB+IF+rg1pDFybWIAqjTn+e XdK+ZDPh7qQoKOKvT+xH0M1u1LIu+c+hDK3NgGoovgUjEqHQt2Lups5ppYL6wH7b5qlE RevQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@adacore.com header.s=google header.b=ho3iySLA; 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 ee26-20020a05620a801a00b00773f7c8ca33si6884250qkb.126.2023.11.07.01.20.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 01:20:15 -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=ho3iySLA; 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 A4409385E01F for ; Tue, 7 Nov 2023 09:20:06 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by sourceware.org (Postfix) with ESMTPS id 973543857351 for ; Tue, 7 Nov 2023 09:19:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 973543857351 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 973543857351 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::32e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699348758; cv=none; b=Mh7gUdQDRdq/OTyUa7lNMDtMo1/QislblR2HWNbcx7SaxB5fR5AUEpGIHJdIk3PTqWIYCiBodWF2dGgWvNiI+j+AvRSwzgT4gSM+Ply3SvrPpIBZuYWztzz+OHdJyn/J2mt15URmMIRHagClqNfoK5B7omIujMBy7n47wmSvalc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699348758; c=relaxed/simple; bh=xbpVV7ktZ0ESgXdtDI7wc2ju4XTrjWvj9oAk8I+j4nc=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=erh317mjZZkoyPco3AAPA6FAD3yCmlu6MX91zsOMmo6p7DysjuT72Ia06fTFfFmJz6/JXTDDjVuOCxif+RuOl5dbI57Wphjch6vsFBV4fEozlEZ6DerQun5Y3jlR+HHkarWnXC4LewkXa950MqFM0UV3n9mMut4q1pnoxyX9Ras= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-4094301d505so40575365e9.2 for ; Tue, 07 Nov 2023 01:19:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1699348755; x=1699953555; 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=K/G1Dd7hi4VhsWoIso0EhDJx8g6dRUkPemMK3HZ8AyU=; b=ho3iySLAXzX4WzMgj3MkvZZrcvfVwfWU58in9IetnkjtkDcNM1If9W3CTLE1JNiKnp Z8ye/28FOAEzOIpa/y0TAD/QBxxa8j2fJq5PItpqikDZA8egArZJA4jMHjVUBhYuxJ6S bU7acRWqTEnQQZx4Pp+DK9iRlVp1KzKt8sZvLaOrGBn6s1ryh4R3TH+BB1E9bwjhGvpv RNkcDhjujGEXzjxgI0SDCFuAXxqhpT7o72fVc33usi65ZlOZ3daRdGU0JERc8Zpq2qpE poKXAh18Ir5dkZ63UkqXbk6vXkBf4ntRg1KyufLOqOvDpHNkZCPqQ9tp3wABazD01l+h 1UYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699348755; x=1699953555; 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=K/G1Dd7hi4VhsWoIso0EhDJx8g6dRUkPemMK3HZ8AyU=; b=VKH08304bA0somkxTQLy4axV5vBELLJBxnEq04fsqNr8YW+Nv2iesS1R+Hl2yHzSxz nDPPNuIsmt7jWJHShjB/7JF4zotL4mrlYR/hcPiIv5/4OuSd4Fx5LUKBRzMlz82ppcJO lZdMr/uFcGPDzHz8UeE6uebxLJKIcpuMtTzgCor8of0yFnQvx82JhBEBYVtC6FoBkC3M U0KscIh9wXvUQMKQk47003C0OeLi1T2Fa1t+N1ow3QBXkPTATCbe+1VG6CIR6BNWNJp7 kXtrdY2ZzHNwLQgWoQD1Hff5mQSJ2XNB1iqVF1EBDW5t7LGQb4dXHBzULmDIZ1HrnPhv IIWw== X-Gm-Message-State: AOJu0YzKktcZ26U5/qA3H1kREHCG5KZ+6iPdlh3RVJaffTnjL360xcfV uZWkNEeuQKn31F97lFlCQVwwJBkdZ8Uil07B3xCVHg== X-Received: by 2002:a05:600c:1d03:b0:408:3c8f:afd9 with SMTP id l3-20020a05600c1d0300b004083c8fafd9mr1547845wms.3.1699348755216; Tue, 07 Nov 2023 01:19:15 -0800 (PST) Received: from localhost.localdomain ([2001:861:3382:1a90:dbc1:a1d1:2e58:4040]) by smtp.gmail.com with ESMTPSA id b5-20020a05600c4e0500b00407b93d8085sm15122338wmq.27.2023.11.07.01.19.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 01:19:14 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Viljar Indus Subject: [COMMITTED] ada: Simplify code for Ignore_Style_Checks_Pragmas Date: Tue, 7 Nov 2023 10:19:12 +0100 Message-ID: <20231107091912.3905235-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: 1781896383862062796 X-GMAIL-MSGID: 1781896383862062796 From: Viljar Indus gcc/ada/ * sem_prag.adb: (Analyze_Pragma): Reduce the number of nested if statements. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_prag.adb | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index b7655759d31..c391e2779bf 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -25109,6 +25109,10 @@ package body Sem_Prag is else Check_Arg_Count (1); + if Ignore_Style_Checks_Pragmas then + return; + end if; + if Nkind (A) = N_String_Literal then S := Strval (A); @@ -25129,9 +25133,7 @@ package body Sem_Prag is -- them in the parser. if J = Slen then - if not Ignore_Style_Checks_Pragmas then - Set_Style_Check_Options (Options); - end if; + Set_Style_Check_Options (Options); exit; end if; @@ -25142,23 +25144,17 @@ package body Sem_Prag is elsif Nkind (A) = N_Identifier then if Chars (A) = Name_All_Checks then - if not Ignore_Style_Checks_Pragmas then - if GNAT_Mode then - Set_GNAT_Style_Check_Options; - else - Set_Default_Style_Check_Options; - end if; + if GNAT_Mode then + Set_GNAT_Style_Check_Options; + else + Set_Default_Style_Check_Options; end if; elsif Chars (A) = Name_On then - if not Ignore_Style_Checks_Pragmas then - Style_Check := True; - end if; + Style_Check := True; elsif Chars (A) = Name_Off then - if not Ignore_Style_Checks_Pragmas then - Style_Check := False; - end if; + Style_Check := False; end if; end if; end if;