]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Fix inconsistent quoting in messages about compile-time errors
authorPiotr Trojanek <trojanek@adacore.com>
Wed, 8 Dec 2021 22:24:13 +0000 (23:24 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Fri, 7 Jan 2022 16:24:08 +0000 (16:24 +0000)
gcc/ada/

* exp_ch4.adb (Raise_Accessibility_Error): Move exception name
to the message string; move << control characters to the end,
for consistency.
* sem_ch6.adb (Analyze_Function_Return): Likewise.
* sem_util.adb (Compile_Time_Constraint_Error): Likewise.
* gcc-interface/decl.c (gnat_to_gnu_entity): Remove quotes
around Storage_Error.
* gcc-interface/trans.c (gnat_to_gnu): Remove quotes around
Constraint_Error.

gcc/testsuite/

* gnat.dg/aggr26.adb: Update expected error message.

gcc/ada/exp_ch4.adb
gcc/ada/gcc-interface/decl.c
gcc/ada/gcc-interface/trans.c
gcc/ada/sem_ch6.adb
gcc/ada/sem_util.adb
gcc/testsuite/gnat.dg/aggr26.adb

index bf96e642e5c9b6a56a0687d6b6ca9b307e6f0b98..262e40e8201770f77d0352d0fb657e42345af478 100644 (file)
@@ -11885,8 +11885,8 @@ package body Exp_Ch4 is
              Reason => PE_Accessibility_Check_Failed));
          Set_Etype (N, Target_Type);
 
-         Error_Msg_N ("<<accessibility check failure", N);
-         Error_Msg_NE ("\<<& [", N, Standard_Program_Error);
+         Error_Msg_N ("accessibility check failure<<", N);
+         Error_Msg_N ("\Program_Error [<<", N);
       end Raise_Accessibility_Error;
 
       ----------------------
index af6b6bd14d422eacc4e50280d809601ff6d2174e..8c0703a3eee20d834e4377cff0b1ced9132b3b9b 100644 (file)
@@ -1400,7 +1400,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
 
                if (TREE_CODE (TYPE_SIZE_UNIT (gnu_alloc_type)) == INTEGER_CST
                    && !valid_constant_size_p (TYPE_SIZE_UNIT (gnu_alloc_type)))
-                 post_error ("??`Storage_Error` will be raised at run time!",
+                 post_error ("??Storage_Error will be raised at run time!",
                              gnat_entity);
 
                gnu_expr
index 3d0820f170b00b04a6112e75829dbf48e451f17c..f767cc6bc3b30b4a8a29a5ffe7434a9a24fa8080 100644 (file)
@@ -8300,7 +8300,7 @@ gnat_to_gnu (Node_Id gnat_node)
   /* If the result is a constant that overflowed, raise Constraint_Error.  */
   if (TREE_CODE (gnu_result) == INTEGER_CST && TREE_OVERFLOW (gnu_result))
     {
-      post_error ("??`Constraint_Error` will be raised at run time", gnat_node);
+      post_error ("??Constraint_Error will be raised at run time", gnat_node);
       gnu_result
        = build1 (NULL_EXPR, gnu_result_type,
                  build_call_raise (CE_Overflow_Check_Failed, gnat_node,
index bd1bb5065d2eca635766cd2558709338db622091..5bfbca89fb54ca99241fd580f10bd3474b0672c0 100644 (file)
@@ -1684,7 +1684,7 @@ package body Sem_Ch6 is
 
                Error_Msg_Warn := SPARK_Mode /= On;
                Error_Msg_N ("cannot return a local value by reference<<", N);
-               Error_Msg_NE ("\& [<<", N, Standard_Program_Error);
+               Error_Msg_N ("\Program_Error [<<", N);
             end if;
          end if;
 
index 2e2ac247047f2b55290e5d8f762f2e18e5fc0707..88181ab274468501d442a55cdf9baaef06b72da4 100644 (file)
@@ -6707,24 +6707,23 @@ package body Sem_Util is
                      if Present (Conc_Typ)
                        and then not Comes_From_Source (Conc_Typ)
                      then
-                        Error_Msg_NEL
-                          ("\& [<<", N, Standard_Constraint_Error, Eloc);
+                        Error_Msg ("\& [<<", Eloc, N);
 
                      else
                         if GNATprove_Mode then
-                           Error_Msg_NEL
-                             ("\& would have been raised for objects of this "
-                              & "type", N, Standard_Constraint_Error, Eloc);
+                           Error_Msg
+                             ("\Constraint_Error would have been raised"
+                              & " for objects of this type", Eloc, N);
                         else
-                           Error_Msg_NEL
-                             ("\& will be raised for objects of this type??",
-                              N, Standard_Constraint_Error, Eloc);
+                           Error_Msg
+                             ("\Constraint_Error will be raised"
+                              & " for objects of this type??", Eloc, N);
                         end if;
                      end if;
                   end;
 
                else
-                  Error_Msg_NEL ("\& [<<", N, Standard_Constraint_Error, Eloc);
+                  Error_Msg ("\Constraint_Error [<<", Eloc, N);
                end if;
 
             else
index 0466473d57bb2385b42a1808e96641b1d9e9e1c1..45370fd098ed883c059f4958155a506180dc62db 100644 (file)
@@ -3,7 +3,7 @@
 procedure Aggr26 is
 
     type Row is array (Positive) of Integer;
-    H : array (Positive) of Row := (others => (others => 0));  --  { dg-warning "\"Storage_Error\" will be raised at run time" }
+    H : array (Positive) of Row := (others => (others => 0));  --  { dg-warning "Storage_Error will be raised at run time" }
 
 begin
    null;