This patch provides a minor improvement to an error message. This is
compiled with -gnatld7 -gnatws -gnatj60:

     1. procedure VolNVol is
     2.    type R is tagged null record;
     3.    procedure Q (A : R) is
     4.    begin
     5.       null;
     6.    end;
     7.    V : R;
     8.    pragma Volatile (V);
     9. begin
    10.    Q (V);
              |
        >>> cannot pass volatile argument to non-volatile
            formal "A"

    11. end VolNVol;

Previously the error did not mention "A" and pointed to the call
Q, instead of the actual V.

Tested on x86_64-pc-linux-gnu, committed on trunk

2011-11-07  Robert Dewar  <de...@adacore.com>

        * sem_res.adb (Resolve_Actuals): Minor error message improvement.

Index: sem_res.adb
===================================================================
--- sem_res.adb (revision 181090)
+++ sem_res.adb (working copy)
@@ -3926,16 +3926,16 @@
                if Is_Atomic_Object (A)
                  and then not Is_Atomic (Etype (F))
                then
-                  Error_Msg_N
-                    ("cannot pass atomic argument to non-atomic formal",
-                     N);
+                  Error_Msg_NE
+                    ("cannot pass atomic argument to non-atomic formal&",
+                     A, F);
 
                elsif Is_Volatile_Object (A)
                  and then not Is_Volatile (Etype (F))
                then
-                  Error_Msg_N
-                    ("cannot pass volatile argument to non-volatile formal",
-                     N);
+                  Error_Msg_NE
+                    ("cannot pass volatile argument to non-volatile formal&",
+                     A, F);
                end if;
             end if;
 

Reply via email to