From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) by sourceware.org (Postfix) with ESMTPS id 7E32F3857C4E for ; Wed, 10 Nov 2021 08:58:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7E32F3857C4E Received: by mail-lj1-x231.google.com with SMTP id 207so3844920ljf.10 for ; Wed, 10 Nov 2021 00:58:28 -0800 (PST) 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=Z0PKm8jQf1TTqTdJdWM3LRF0i9GRvRJHgfGAtlb7hFw=; b=1ueSjTpoq5XLE3MSm4ZgE1Ph2KCqC/N4BkShs1bCbc7ft1ejtDh/juky2kawkzh8kB o9hZObX29T9qL4SWCdIx2fCPO9i4GXXHNlwXTYtpKpRZ1SRE2IlLr8PqCT4jaEli1Qiu PfXkNBFw3845jnDDaMmBWwhNW2wn6gkL4vEeX7m6ZFhWc9VHIfKOI/YfBmQPiPb710X1 X4e3cdhlWmq8hNkHU+RUjnhdR4FGrfT66dRmmDP07g5Za5MN7otcpumeKGZI7FHgZ/J0 Lfo2sWX+BUN7FvGUtvNf3yJKpM4fI2fJ0eaD3GesIe+H9j87SnyCS1R6M4v7nLkFfp6a ftsw== X-Gm-Message-State: AOAM532a8ZWP50D0oMAALEm+yljlKt4b4kEtgJHhxn5ODA1gogxy2G98 bDc19Z+qhef0jq5akSlinAjrI4VcwY5ssg== X-Google-Smtp-Source: ABdhPJyg4hh52RQAx9t7vUk1GA7c/OnAgYB5sbG3vGLYWXY1co36PmbBahR1OtCTo55cO217pnt1NQ== X-Received: by 2002:a2e:9a09:: with SMTP id o9mr14629609lji.21.1636534706108; Wed, 10 Nov 2021 00:58:26 -0800 (PST) Received: from adacore.com ([2a02:2ab8:224:2ce:72b5:e8ff:feef:ee60]) by smtp.gmail.com with ESMTPSA id b12sm1231412lfv.91.2021.11.10.00.58.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Nov 2021 00:58:25 -0800 (PST) Date: Wed, 10 Nov 2021 08:58:24 +0000 From: Pierre-Marie de Rodat To: gcc-patches@gcc.gnu.org Cc: Yannick Moy Subject: [Ada] Better error message on missing parentheses Message-ID: <20211110085824.GA2810986@adacore.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="vkogqOf2sHV7VnPd" 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-List-Received-Date: Wed, 10 Nov 2021 08:58:38 -0000 --vkogqOf2sHV7VnPd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Adapt the test to issue a different error message when it is likely that an if-expression is suspected, but parentheses are missing. This makes the test more in line with its comment. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * par-ch4.adb (P_Primary): Adapt test for getting error message on missing parentheses. --vkogqOf2sHV7VnPd Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="patch.diff" diff --git a/gcc/ada/par-ch4.adb b/gcc/ada/par-ch4.adb --- a/gcc/ada/par-ch4.adb +++ b/gcc/ada/par-ch4.adb @@ -2892,8 +2892,10 @@ package body Ch4 is if Token_Is_At_Start_Of_Line and then not (Ada_Version >= Ada_2012 - and then Style_Check_Indentation /= 0 - and then Start_Column rem Style_Check_Indentation /= 0) + and then + (Style_Check_Indentation = 0 + or else + Start_Column rem Style_Check_Indentation /= 0)) then Error_Msg_AP ("missing operand"); return Error; --vkogqOf2sHV7VnPd--