From bac0819a21796b902f9c975c6ed03bde4dc65ad3 Mon Sep 17 00:00:00 2001
From: Robert Dewar <dewar@adacore.com>
Date: Fri, 18 Mar 2005 12:50:53 +0100
Subject: [PATCH] par.adb (Par): Improved msg for attempt to recompile
 predefined unit

2005-03-17  Robert Dewar  <dewar@adacore.com>

	* par.adb (Par): Improved msg for attempt to recompile predefined unit

From-SVN: r96672
---
 gcc/ada/par.adb | 60 ++++++++++++++++++++++++++++++-------------------
 1 file changed, 37 insertions(+), 23 deletions(-)

diff --git a/gcc/ada/par.adb b/gcc/ada/par.adb
index 8b4e69081b76..290ad0b74da2 100644
--- a/gcc/ada/par.adb
+++ b/gcc/ada/par.adb
@@ -1318,9 +1318,9 @@ begin
                end if;
             end;
 
-            --  Here if we are not skipping a file in multiple unit per file
-            --  mode. Parse the unit that we are interested in. Note that in
-            --  check syntax mode we are interested in all units in the file.
+         --  Here if we are not skipping a file in multiple unit per file
+         --  mode. Parse the unit that we are interested in. Note that in
+         --  check syntax mode we are interested in all units in the file.
 
          else
             declare
@@ -1355,25 +1355,38 @@ begin
 
                      Name := Uname (Uname'First .. Uname'Last - 2);
 
-                     if (Name = "ada"                    or else
-                         Name = "calendar"               or else
-                         Name = "interfaces"             or else
-                         Name = "system"                 or else
-                         Name = "machine_code"           or else
-                         Name = "unchecked_conversion"   or else
-                         Name = "unchecked_deallocation"
-                           or else (Name'Length > 4
-                                     and then
-                                       Name (Name'First .. Name'First + 3) =
-                                                                 "ada.")
-                           or else (Name'Length > 11
-                                     and then
-                                       Name (Name'First .. Name'First + 10) =
-                                                                 "interfaces.")
-                           or else (Name'Length > 7
-                                     and then
-                                       Name (Name'First .. Name'First + 6) =
-                                                                 "system."))
+                     if Name = "ada"                    or else
+                        Name = "calendar"               or else
+                        Name = "interfaces"             or else
+                        Name = "system"                 or else
+                        Name = "machine_code"           or else
+                        Name = "unchecked_conversion"   or else
+                        Name = "unchecked_deallocation"
+                     then
+                        Error_Msg
+                          ("language defined units may not be recompiled",
+                           Sloc (Unit (Comp_Unit_Node)));
+
+                     elsif Name'Length > 4
+                       and then
+                         Name (Name'First .. Name'First + 3) = "ada."
+                     then
+                        Error_Msg
+                          ("descendents of package Ada " &
+                             "may not be compiled",
+                           Sloc (Unit (Comp_Unit_Node)));
+
+                     elsif Name'Length > 11
+                       and then
+                         Name (Name'First .. Name'First + 10) = "interfaces."
+                     then
+                        Error_Msg
+                          ("descendents of package Interfaces " &
+                             "may not be compiled",
+                           Sloc (Unit (Comp_Unit_Node)));
+
+                     elsif Name'Length > 7
+                       and then Name (Name'First .. Name'First + 6) = "system."
                        and then Name /= "system.rpc"
                        and then
                          (Name'Length < 11
@@ -1381,7 +1394,8 @@ begin
                                                                  "system.rpc.")
                      then
                         Error_Msg
-                          ("language defined units may not be recompiled",
+                          ("descendents of package System " &
+                             "may not be compiled",
                            Sloc (Unit (Comp_Unit_Node)));
                      end if;
                   end;