aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/par.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2004-04-01 12:04:40 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2004-04-01 12:04:40 +0200
commit6b6fcd3ead62875b86a999a28c070bc88ef37d6e (patch)
treeb338d3df4e73cbb9b9be4f8a5366b15275287114 /gcc/ada/par.adb
parent2ae6e9823a58bd58377b48e7a412575f1a08c585 (diff)
downloadgcc-6b6fcd3ead62875b86a999a28c070bc88ef37d6e.zip
gcc-6b6fcd3ead62875b86a999a28c070bc88ef37d6e.tar.gz
gcc-6b6fcd3ead62875b86a999a28c070bc88ef37d6e.tar.bz2
[multiple changes]
2004-04-01 Robert Dewar <dewar@gnat.com> * checks.adb: Minor reformatting throughout Note that prev checkin added RM reference to alignment warning 2004-04-01 Ed Schonberg <schonberg@gnat.com> * exp_aggr.adb (Get_Component_Val): Treat a string literal as non-static when building aggregate for bit-packed array. * exp_ch4.adb (Expand_N_Slice): If a packed slice is an actual of a function call that is itself the actual in a procedure call, build temporary for it. * exp_pakd.adb (Expand_Bit_Packed_Element_Set): If right-hand side is a string literal, create a temporary for it, constant folding only handles scalars here. 2004-04-01 Vincent Celier <celier@gnat.com> * ali-util.adb (Post_Scan, Error_Msg, Error_Msg_S, Error_Msg_SC, Error_Msg_SP): New empty procedures to instantiate the Scanner. (Style, Scanner): Instantiations of Styleg and Scng to be able to scan tokens. (Accumulate_Checksum, Initialize_Checksum): Remove procedures. (Get_File_Checksum): Use the instantiated scanner to scan all the tokens and get the checksum. * make.adb (Gnatmake): Do not insert into Q the Main_Source if it is already in the Q. Increase the Marking_Label at the end of the Multiple_Main_Loop, instead of at the beginning. * osint.adb (Lib_File_Name): Use Multi_Unit_Index_Character, not '~' directly. (Osint package elaboration): Change Multi_Unit_Index_Character to '$' if on VMS. * osint.ads (Multi_Unit_Index_Character): New Character global variable * osint-c.adb (Set_Library_Info_Name): Use Multi_Unit_Index_Character, not '~' directly. * par.adb: Remove test on file name to detect language defined units. Add test on unit name, after parsing, to detect language defined units that are not compiled with -gnatg (except System.RPC and its children) * par-ch10.adb (P_Compilation_Unit): In multi-unit sources, scan the following units without style checking. * switch-c.adb: Change -gnatC to -gnateI * usage.adb: Document new switch -gnateInnn * scng.adb (Accumulate_Token_Checksum): New procedure (Scan): Call Accumulate_Token_Checksum after each identifier, reserved word or literal number. (Scan.Nlit.Scan_Integer): Do not accumulate internal '_' in litteral numbers. 2004-04-01 Thomas Quinot <quinot@act-europe.fr> * a-tasatt.adb, g-comlin.adb, sinput-c.adb, s-secsta.adb, s-tpobop.adb, switch-m.adb, 56taprop.adb, 5ginterr.adb, 5gmastop.adb, 5staprop.adb, 5vinterr.adb, 5vtaprop.adb, 5vtpopde.adb, 5vtpopde.adb: Add missing 'constant' keywords. 2004-04-01 Javier Miranda <miranda@gnat.com> * par-ch4.adb: (P_Allocator): Code cleanup * sem_ch3.adb (Access_Definition): Properly set the null-excluding attribute. * sinfo.ads: Complete documentation of previous change 2004-04-01 GNAT Script <nobody@gnat.com> * Make-lang.in: Makefile automatically updated 2004-04-01 Pascal Obry <obry@gnat.com> * gnatlink.adb (Process_Binder_File): Remove duplicate linker options only on VMS. This special handling was done because an old GNU/ld bug on Windows which has been fixed. From-SVN: r80290
Diffstat (limited to 'gcc/ada/par.adb')
-rw-r--r--gcc/ada/par.adb94
1 files changed, 61 insertions, 33 deletions
diff --git a/gcc/ada/par.adb b/gcc/ada/par.adb
index 1a1d975..dbec0b8 100644
--- a/gcc/ada/par.adb
+++ b/gcc/ada/par.adb
@@ -1233,38 +1233,6 @@ begin
else
Save_Opt_Config_Switches (Save_Config_Switches);
- -- Special processing for language defined units. For this purpose
- -- we do NOT consider the renamings in annex J as predefined. That
- -- allows users to compile their own versions of these files, and
- -- in particular, in the VMS implementation, the DEC versions can
- -- be substituted for the standard Ada 95 versions.
-
- if Is_Predefined_File_Name
- (Fname => File_Name (Current_Source_File),
- Renamings_Included => False)
- then
- Set_Opt_Config_Switches
- (Is_Internal_File_Name (File_Name (Current_Source_File)));
-
- -- If this is the main unit, disallow compilation unless the -gnatg
- -- (GNAT mode) switch is set (from a user point of view, the rule is
- -- that language defined units cannot be recompiled).
-
- -- However, an exception is s-rpc, and its children. We test this
- -- by looking at the characters after the minus. The rule is that
- -- only s-rpc and its children have names starting s-rp.
-
- Get_Name_String (File_Name (Current_Source_File));
-
- if (Name_Len < 5 or else Name_Buffer (1 .. 4) /= "s-rp")
- and then Current_Source_Unit = Main_Unit
- and then not GNAT_Mode
- and then Operating_Mode = Generate_Code
- then
- Error_Msg_SC ("language defined units may not be recompiled");
- end if;
- end if;
-
-- The following loop runs more than once in syntax check mode
-- where we allow multiple compilation units in the same file
-- and in Multiple_Unit_Per_file mode where we skip units till
@@ -1298,10 +1266,15 @@ begin
Save_Operating_Mode : constant Operating_Mode_Type :=
Operating_Mode;
+ Save_Style_Check : constant Boolean := Style_Check;
+
+
begin
Operating_Mode := Check_Syntax;
+ Style_Check := False;
Discard_Node (P_Compilation_Unit);
Operating_Mode := Save_Operating_Mode;
+ Style_Check := Save_Style_Check;
-- If we are at an end of file, and not yet at the right
-- unit, then we have a fatal error. The unit is missing.
@@ -1317,7 +1290,62 @@ begin
-- check syntax mode we are interested in all units in the file.
else
- Discard_Node (P_Compilation_Unit);
+ declare
+ Comp_Unit_Node : constant Node_Id := P_Compilation_Unit;
+
+ begin
+ -- If parsing was successful and we are not in check syntax
+ -- mode, check that language defined units are compiled in
+ -- GNAT mode. For this purpose we do NOT consider renamings
+ -- in annex J as predefined. That allows users to compile
+ -- their own versions of these files, and in particular,
+ -- in the VMS implementation, the DEC versions can be
+ -- substituted for the standard Ada 95 versions. Another
+ -- exception is System.RPC and its children. This allows
+ -- a user to supply their own communication layer.
+
+ if Comp_Unit_Node /= Error
+ and then Operating_Mode = Generate_Code
+ and then Current_Source_Unit = Main_Unit
+ and then not GNAT_Mode
+ then
+ declare
+ Name : constant String :=
+ Get_Name_String
+ (Unit_Name (Current_Source_Unit));
+ begin
+ 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."))
+ and then Name /= "system.rpc"
+ and then
+ (Name'Length < 11
+ or else Name (Name'First .. Name'First + 10) /=
+ "system.rpc.")
+ then
+ Error_Msg
+ ("language defined units may not be recompiled",
+ Sloc (Unit (Comp_Unit_Node)));
+ end if;
+ end;
+ end if;
+ end;
-- All done if at end of file