]> gcc.gnu.org Git - gcc.git/commitdiff
[Ada] Fix error message for import aspect
authorGhjuvan Lacambre <lacambre@adacore.com>
Fri, 14 Aug 2020 09:34:06 +0000 (11:34 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Thu, 22 Oct 2020 12:11:20 +0000 (08:11 -0400)
gcc/ada/

* sem_prag.adb (Process_Convention,
Process_Import_Or_Interface): Fix error message.

gcc/ada/sem_prag.adb

index ba867231685a5700f534de705c4cc93c3fc7b9ce..4c7131accf1135598f08b8fc3d1051d0f4e5b8ca 100644 (file)
@@ -8270,8 +8270,13 @@ package body Sem_Prag is
             --  Accept Intrinsic Export on types if Relaxed_RM_Semantics
 
             if not (Is_Type (E) and then Relaxed_RM_Semantics) then
-               Error_Pragma_Arg
-                 ("second argument of pragma% must be a subprogram", Arg2);
+               if From_Aspect_Specification (N) then
+                  Error_Pragma_Arg
+                     ("entity for aspect% must be a subprogram", Arg2);
+               else
+                  Error_Pragma_Arg
+                     ("second argument of pragma% must be a subprogram", Arg2);
+               end if;
             end if;
 
          --  Special checks for C_Variadic_n
@@ -9543,10 +9548,17 @@ package body Sem_Prag is
             Process_Import_Predefined_Type;
 
          else
-            Error_Pragma_Arg
-              ("second argument of pragma% must be object, subprogram "
-               & "or incomplete type",
-               Arg2);
+            if From_Aspect_Specification (N) then
+               Error_Pragma_Arg
+                  ("entity for aspect% must be object, subprogram "
+                     & "or incomplete type",
+                   Arg2);
+            else
+               Error_Pragma_Arg
+                  ("second argument of pragma% must be object, subprogram "
+                     & "or incomplete type",
+                   Arg2);
+            end if;
          end if;
 
          --  If this pragma applies to a compilation unit, then the unit, which
This page took 0.109033 seconds and 5 git commands to generate.