From: Viljar Indus <in...@adacore.com>

The implementation was duplicated in errout and errutil. Move
the implementation to erroutc where other similar commonly used
functions are.

gcc/ada/ChangeLog:

        * errout.adb: Remove implemntation of Set_Msg_Insertion_Column.
        * erroutc.adb: Add implementation of Set_Msg_Insertion_Column.
        * erroutc.ads: Add spec of Set_Msg_Insertion_Column.
        * errutil.adb: Remove implementation of Set_Msg_Insertion_Column.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/errout.adb  | 16 ----------------
 gcc/ada/erroutc.adb | 13 +++++++++++++
 gcc/ada/erroutc.ads |  3 +++
 gcc/ada/errutil.adb | 17 +----------------
 4 files changed, 17 insertions(+), 32 deletions(-)

diff --git a/gcc/ada/errout.adb b/gcc/ada/errout.adb
index 8858df11737..4070d92992d 100644
--- a/gcc/ada/errout.adb
+++ b/gcc/ada/errout.adb
@@ -52,7 +52,6 @@ with Sinfo.Utils;    use Sinfo.Utils;
 with Snames;         use Snames;
 with Stand;          use Stand;
 with Stringt;        use Stringt;
-with Stylesw;        use Stylesw;
 with System.OS_Lib;
 with Uname;          use Uname;
 with Warnsw;
@@ -143,9 +142,6 @@ package body Errout is
    --  around node N are required by the Ada syntax, e.g. when N is an
    --  expression of a qualified expression.
 
-   procedure Set_Msg_Insertion_Column;
-   --  Handle column number insertion (@ insertion character)
-
    procedure Set_Msg_Insertion_Node;
    --  Handle node (name from node) insertion (& insertion character)
 
@@ -3776,18 +3772,6 @@ package body Errout is
       Errors_Must_Be_Ignored := To;
    end Set_Ignore_Errors;
 
-   ------------------------------
-   -- Set_Msg_Insertion_Column --
-   ------------------------------
-
-   procedure Set_Msg_Insertion_Column is
-   begin
-      if RM_Column_Check then
-         Set_Msg_Str (" in column ");
-         Set_Msg_Int (Int (Error_Msg_Col) + 1);
-      end if;
-   end Set_Msg_Insertion_Column;
-
    ----------------------------
    -- Set_Msg_Insertion_Node --
    ----------------------------
diff --git a/gcc/ada/erroutc.adb b/gcc/ada/erroutc.adb
index 9d22996204c..209159e1765 100644
--- a/gcc/ada/erroutc.adb
+++ b/gcc/ada/erroutc.adb
@@ -42,6 +42,7 @@ with Sinfo.Nodes;
 with Sinput;   use Sinput;
 with Snames;   use Snames;
 with Stringt;  use Stringt;
+with Stylesw;  use Stylesw;
 with Targparm;
 with Uintp;    use Uintp;
 with Widechar; use Widechar;
@@ -1330,6 +1331,18 @@ package body Erroutc is
       end loop;
    end Set_Msg_Insertion_Code;
 
+   ------------------------------
+   -- Set_Msg_Insertion_Column --
+   ------------------------------
+
+   procedure Set_Msg_Insertion_Column is
+   begin
+      if RM_Column_Check then
+         Set_Msg_Str (" in column ");
+         Set_Msg_Int (Int (Error_Msg_Col) + 1);
+      end if;
+   end Set_Msg_Insertion_Column;
+
    ---------------------------------
    -- Set_Msg_Insertion_File_Name --
    ---------------------------------
diff --git a/gcc/ada/erroutc.ads b/gcc/ada/erroutc.ads
index 76cd0205fa8..0853bdbeab6 100644
--- a/gcc/ada/erroutc.ads
+++ b/gcc/ada/erroutc.ads
@@ -576,6 +576,9 @@ package Erroutc is
    procedure Set_Msg_Insertion_Code;
    --  Handle error code insertion ([] insertion character)
 
+   procedure Set_Msg_Insertion_Column;
+   --  Handle column number insertion (@ insertion character)
+
    procedure Set_Msg_Insertion_File_Name;
    --  Handle file name insertion (left brace insertion character)
 
diff --git a/gcc/ada/errutil.adb b/gcc/ada/errutil.adb
index 1094e8ac317..0891d4618aa 100644
--- a/gcc/ada/errutil.adb
+++ b/gcc/ada/errutil.adb
@@ -32,7 +32,6 @@ with Output;   use Output;
 with Scans;    use Scans;
 with Sinput;   use Sinput;
 with Stringt;  use Stringt;
-with Stylesw;  use Stylesw;
 
 package body Errutil is
 
@@ -58,9 +57,6 @@ package body Errutil is
    --  indicates if there are errors attached to the line, which forces
    --  listing on, even in the presence of pragma List (Off).
 
-   procedure Set_Msg_Insertion_Column;
-   --  Handle column number insertion (@ insertion character)
-
    procedure Set_Msg_Text (Text : String; Flag : Source_Ptr);
    --  Add a sequence of characters to the current message. The characters may
    --  be one of the special insertion characters (see documentation in spec).
@@ -495,6 +491,7 @@ package body Errutil is
          if Warnings_Detected >= Maximum_Messages then
             Set_Standard_Error;
             Write_Line ("maximum number of warnings detected");
+
             Warning_Mode := Suppress;
          end if;
 
@@ -605,18 +602,6 @@ package body Errutil is
       Errors_Must_Be_Ignored := To;
    end Set_Ignore_Errors;
 
-   ------------------------------
-   -- Set_Msg_Insertion_Column --
-   ------------------------------
-
-   procedure Set_Msg_Insertion_Column is
-   begin
-      if RM_Column_Check then
-         Set_Msg_Str (" in column ");
-         Set_Msg_Int (Int (Error_Msg_Col) + 1);
-      end if;
-   end Set_Msg_Insertion_Column;
-
    ------------------
    -- Set_Msg_Text --
    ------------------
-- 
2.43.0

Reply via email to