From patchwork Mon Oct 4 08:48:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Marie de Rodat X-Patchwork-Id: 1536013 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=AjnONr9A; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HNFHh5GLRz9t0k for ; Mon, 4 Oct 2021 20:08:16 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7C4333858410 for ; Mon, 4 Oct 2021 09:08:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7C4333858410 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1633338494; bh=DN1jEZBP4rOIvrFS+O7S0r2EgAG1OKrBRGKK+esKwho=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=AjnONr9AiW75Z6nk59OJlgmewBRBrol8LkUjz2+zqs3O7F4pjdWWpKjava0X2vfrx y/4H9AXRNHv92tHpPr/NmVAfWr8iU7ZNek2y8Kon/oBxPRGvIeb6rS2zJ+nwxtIkUq svd9Qxp5j3nB0IErcH1KHeoEcYGF8gGLBNwIYsF4= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by sourceware.org (Postfix) with ESMTPS id A49A6385840A for ; Mon, 4 Oct 2021 08:48:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A49A6385840A Received: by mail-lf1-x12f.google.com with SMTP id y26so68699012lfa.11 for ; Mon, 04 Oct 2021 01:48:14 -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=DN1jEZBP4rOIvrFS+O7S0r2EgAG1OKrBRGKK+esKwho=; b=ukYzdaP30W07Z5Di+vOHnjkTGSY+zmnbqVc+iX5FZ7imWbmoJX7xj2Ssb+GgbRFuaR XvgrCiUiss+zATb4HQ+fyw5TS49U7fQgNm8YdTPoJuXcjAGuB05x6h6dnbPpbFNaiPhe A5erbjn7UIIOEy1IGlh+MpkYevxDxhuo/+56aWNP5HizdtK/Q+2ADpGoUsLda4Kl+sud C/FgmTgW9uCyPKRq7BQAmnVGJoFYpbTII08m6720Sp7hfrsGKjieOARZOIVNp3PUKSvK h0Xhz5XbIJevTT2VvdCv3bYl5r1t69oppbMabUp4igtiSAm97B9LabI/p5Enz1E4haLE AQuQ== X-Gm-Message-State: AOAM531lwCSUAL1Z5Tpko0xN39y6TGLB8QAhnVORnb/v+9IU2Jah8vX/ s65xlmd8zjFGyL1CaogAQbq6qy34EYCBQg== X-Google-Smtp-Source: ABdhPJzcZVhVCjsM+1Il46YQx76SMRQyhVnipjklNA9g7+usiwGsKMwfCOfoq0zYsLwtgYxfZbX7Zw== X-Received: by 2002:a05:6512:2034:: with SMTP id s20mr2084480lfs.419.1633337293585; Mon, 04 Oct 2021 01:48:13 -0700 (PDT) Received: from adacore.com ([2a02:2ab8:224:2ce:72b5:e8ff:feef:ee60]) by smtp.gmail.com with ESMTPSA id v27sm1693054lfp.0.2021.10.04.01.48.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Oct 2021 01:48:12 -0700 (PDT) Date: Mon, 4 Oct 2021 08:48:11 +0000 To: gcc-patches@gcc.gnu.org Subject: [Ada] Refactor duplicate code for pretty-printing GNAT AST Message-ID: <20211004084811.GA1537917@adacore.com> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-13.0 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.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-Patchwork-Original-From: Pierre-Marie de Rodat via Gcc-patches From: Pierre-Marie de Rodat Reply-To: Pierre-Marie de Rodat Cc: Piotr Trojanek Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Remove duplicated CASE branches detected by infer; semantics is unaffected. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sprint.adb (Sprint_Node_Actual): Refactor code for generic package and subprogram declarations. diff --git a/gcc/ada/sprint.adb b/gcc/ada/sprint.adb --- a/gcc/ada/sprint.adb +++ b/gcc/ada/sprint.adb @@ -2075,7 +2075,7 @@ package body Sprint is Sprint_Node (Name (Node)); Write_Char (';'); - when N_Generic_Package_Declaration => + when N_Generic_Declaration => Extra_Blank_Line; Write_Indent_Str_Sloc ("generic "); Sprint_Indented_List (Generic_Formal_Declarations (Node)); @@ -2097,14 +2097,6 @@ package body Sprint is Sprint_Node (Name (Node)); Write_Char (';'); - when N_Generic_Subprogram_Declaration => - Extra_Blank_Line; - Write_Indent_Str_Sloc ("generic "); - Sprint_Indented_List (Generic_Formal_Declarations (Node)); - Write_Indent; - Sprint_Node (Specification (Node)); - Write_Char (';'); - when N_Goto_Statement => Write_Indent_Str_Sloc ("goto "); Sprint_Node (Name (Node));