From: Piotr Trojanek Date: Mon, 13 Feb 2023 21:49:39 +0000 (+0100) Subject: ada: Ignore accessibility actuals in expression pretty-printer X-Git-Tag: basepoints/gcc-15~9046 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e32c1944bbad9e3dad86a3f1a010fab671953130;p=thirdparty%2Fgcc.git ada: Ignore accessibility actuals in expression pretty-printer Extra actual parameters for accessibility checks are confusing for the expression pretty-printer that is used by CodePeer. It seems that nodes created for the accessibility checks should use the Sloc of the source expression of accessibility checks, not the target. However, this is problematic to achieve with the current implementation of accessibility checks, so with this patch we will simply ignore the accessibility actuals when computing Slocs for expression pretty-printing. gcc/ada/ * errout.adb (First_And_Last_Nodes): Ignore accessibility parameters. --- diff --git a/gcc/ada/errout.adb b/gcc/ada/errout.adb index 0a36a1d74662..5c3e76c5ecaf 100644 --- a/gcc/ada/errout.adb +++ b/gcc/ada/errout.adb @@ -1769,6 +1769,24 @@ package body Errout is Loc : constant Source_Ptr := Sloc (Norig); begin + -- ??? For assignments that require accessiblity checks, e.g.: + -- + -- Y := Func (123); + -- + -- the function call gets an extra actual parameter association with + -- Sloc of the assigned name "Y": + -- + -- Y := Func (123, A8b => 2); + -- + -- We can simply ignore those extra actual parameters when + -- determining the Sloc range of the "Func (123)" expression. + + if Nkind (N) = N_Parameter_Association + and then Is_Accessibility_Actual (N) + then + return Skip; + end if; + -- Check for earlier if Loc < Eloc