diff options
author | Vincent Celier <celier@adacore.com> | 2007-04-06 11:19:38 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2007-04-06 11:19:38 +0200 |
commit | 958a816e69e829d04e175512a09f8b6f43cd2ffd (patch) | |
tree | f5cd92cf0c8355154424935e5aa51a46816033b9 /gcc/ada/switch-m.adb | |
parent | fea9e956ec1b3e1b95f79e44309cfa93314ddbce (diff) | |
download | gcc-958a816e69e829d04e175512a09f8b6f43cd2ffd.tar.gz |
errutil.adb (Initialize): Initialize warnings table...
2007-04-06 Vincent Celier <celier@adacore.com>
* errutil.adb (Initialize): Initialize warnings table, if all warnings
are suppressed, supply an initial dummy entry covering all possible
source locations.
* make.adb (Scan_Make_Arg): Reject options that should start with "--"
and start with only one, such as "-RTS=none".
(Collect_Arguments): Do not check for sources outside of projects.
Do not collect arguments if project is externally built.
(Compile_Sources): Do nothing, not even check if the source is up to
date, if its project is externally built.
(Compile): When compiling a predefined source, add -gnatpg
as the second switch, after -c.
(Compile_Sources): Allow compilation of Annex J renames without -a
(Is_In_Object_Directory): Check if the ALI file is in the object
even if there is no project extension.
(Create_Binder_Mapping_File): Only put a unit in the mapping file for
gnatbind if the ALI file effectively exists.
(Initialize): Add the directory where gnatmake is invoked in front of
the path if it is invoked from a bin directory, even without directory
information, so that the correct GNAT tools will be used when spawned
without directory information.
* makeusg.adb: Change switch -S to -eS
Add lines for new switches -we, -wn and -ws
Add line for new switch -p
* prj-proc.adb (Process): Set Success to False when Warning_Mode is
Treat_As_Error and there are warnings.
* switch-m.ads, switch-m.adb (Normalize_Compiler_Switches): Do not skip
-gnatww Change gnatmake switch -S to -eS
(Scan_Make_Switches): Code reorganisation. Process separately multi
character switches and single character switches.
(Scan_Make_Switches): New Boolean out parameter Success. Set Success to
False when switch is not recognized by gnatmake.
(Scan_Make_Switches): Set Setup_Projects True when -p or
--create-missing-dirs is specified.
* fname.adb (Is_Predefined_File_Name): Return True for annex J
renamings Calendar, Machine_Code, Unchecked_Conversion and
Unchecked_Deallocation only when Renamings_Included is True.
* par.adb: Allow library units Calendar, Machine_Code,
Unchecked_Conversion and Unchecked_Deallocation to be recompiled even
when -gnatg is not specified.
(P_Interface_Type_Definition): Remove the formal Is_Synchronized because
there is no need to generate always a record_definition_node in case
of synchronized interface types.
(SIS_Entry_Active): Initialize global variable to False
(P_Null_Exclusion): For AI-447: Add parameter Allow_Anonymous_In_95 to
indicate cases where AI-447 says "not null" is legal.
* makeutl.ads, makeutil.adb (Executable_Prefix_Path): New function
* makegpr.adb (Check_Compilation_Needed): Take into account dependency
files with with several lines starting with the object fileb name.
(Scan_Arg): Set Setup_Projects True when -p or --create-missing-dirs
is specified.
(Initialize): Add the directory where gprmake is invoked in front of the
path, if it is invoked from a bin directory or with directory
information, so that the correct GNAT tools will be used when invoked
directly.
(Check_Compilation_Needed): Process correctly backslashes on Windows.
* vms_data.ads: Update switches/qualifiers
From-SVN: r123560
Diffstat (limited to 'gcc/ada/switch-m.adb')
-rw-r--r-- | gcc/ada/switch-m.adb | 404 |
1 files changed, 213 insertions, 191 deletions
diff --git a/gcc/ada/switch-m.adb b/gcc/ada/switch-m.adb index dc3fe569356..a9239608b0a 100644 --- a/gcc/ada/switch-m.adb +++ b/gcc/ada/switch-m.adb @@ -363,44 +363,40 @@ package body Switch.M is C := Switch_Chars (Ptr); Ptr := Ptr + 1; - -- 'w' should be skipped in -gnatw + -- -gnatyMxxx - if C /= 'w' or else Storing (First_Stored) /= 'w' then - - -- -gnatyMxxx - - if C = 'M' - and then Storing (First_Stored) = 'y' then - Last_Stored := First_Stored + 1; - Storing (Last_Stored) := 'M'; - - while Ptr <= Max loop - C := Switch_Chars (Ptr); - exit when C not in '0' .. '9'; - Last_Stored := Last_Stored + 1; - Storing (Last_Stored) := C; - Ptr := Ptr + 1; - end loop; - - -- If there is no digit after -gnatyM, - -- the switch is invalid. + if C = 'M' and then + Storing (First_Stored) = 'y' + then + Last_Stored := First_Stored + 1; + Storing (Last_Stored) := 'M'; - if Last_Stored = First_Stored + 1 then - Last := 0; - return; + while Ptr <= Max loop + C := Switch_Chars (Ptr); + exit when C not in '0' .. '9'; + Last_Stored := Last_Stored + 1; + Storing (Last_Stored) := C; + Ptr := Ptr + 1; + end loop; - else - Add_Switch_Component - (Storing (Storing'First .. Last_Stored)); - end if; + -- If there is no digit after -gnatyM, + -- the switch is invalid. - -- All other switches are -gnatxx + if Last_Stored = First_Stored + 1 then + Last := 0; + return; else - Storing (First_Stored + 1) := C; Add_Switch_Component - (Storing (Storing'First .. First_Stored + 1)); + (Storing (Storing'First .. Last_Stored)); end if; + + -- All other switches are -gnatxx + + else + Storing (First_Stored + 1) := C; + Add_Switch_Component + (Storing (Storing'First .. First_Stored + 1)); end if; end loop; @@ -481,12 +477,19 @@ package body Switch.M is -- Scan_Make_Switches -- ------------------------ - procedure Scan_Make_Switches (Switch_Chars : String) is + procedure Scan_Make_Switches + (Switch_Chars : String; + Success : out Boolean) + is Ptr : Integer := Switch_Chars'First; Max : constant Integer := Switch_Chars'Last; C : Character := ' '; begin + -- Assume a good switch + + Success := True; + -- Skip past the initial character (must be the switch character) if Ptr = Max then @@ -496,70 +499,42 @@ package body Switch.M is Ptr := Ptr + 1; end if; - -- A little check, "gnat" at the start of a switch is not allowed - -- except for the compiler (where it was already removed) + -- A little check, "gnat" at the start of a switch is for the compiler if Switch_Chars'Length >= Ptr + 3 and then Switch_Chars (Ptr .. Ptr + 3) = "gnat" then - Osint.Fail - ("invalid switch: """, Switch_Chars, """ (gnat not needed here)"); + Success := False; + return; end if; - -- Loop to scan through switches given in switch string - - Check_Switch : begin - C := Switch_Chars (Ptr); - - -- Processing for a switch - - case C is - - when 'a' => - Ptr := Ptr + 1; - Check_Readonly_Files := True; - - -- Processing for b switch - - when 'b' => - Ptr := Ptr + 1; - Bind_Only := True; - Make_Steps := True; - - -- Processing for B switch + C := Switch_Chars (Ptr); - when 'B' => - Ptr := Ptr + 1; - Build_Bind_And_Link_Full_Project := True; - - -- Processing for c switch - - when 'c' => - Ptr := Ptr + 1; - Compile_Only := True; - Make_Steps := True; + -- Multiple character switches - -- Processing for C switch + if Switch_Chars'Length > 2 then + if Switch_Chars = "--create-missing-dirs" then + Setup_Projects := True; - when 'C' => + elsif C = 'v' and then Switch_Chars'Length = 3 then Ptr := Ptr + 1; - Create_Mapping_File := True; - - -- Processing for D switch + Verbose_Mode := True; - when 'D' => - Ptr := Ptr + 1; + case Switch_Chars (Ptr) is + when 'l' => + Verbosity_Level := Opt.Low; - if Object_Directory_Present then - Osint.Fail ("duplicate -D switch"); + when 'm' => + Verbosity_Level := Opt.Medium; - else - Object_Directory_Present := True; - end if; + when 'h' => + Verbosity_Level := Opt.High; - -- Processing for d switch + when others => + Success := False; + end case; - when 'd' => + elsif C = 'd' then -- Note: for the debug switch, the remaining characters in this -- switch field must all be debug flags, since all valid switch @@ -580,17 +555,9 @@ package body Switch.M is end if; end loop; - return; - - -- Processing for e switch - - when 'e' => + elsif C = 'e' then Ptr := Ptr + 1; - if Ptr > Max then - Bad_Switch (Switch_Chars); - end if; - case Switch_Chars (Ptr) is -- Processing for eI switch @@ -599,164 +566,219 @@ package body Switch.M is Ptr := Ptr + 1; Scan_Pos (Switch_Chars, Max, Ptr, Main_Index, C); + if Ptr <= Max then + Bad_Switch (Switch_Chars); + end if; + -- Processing for eL switch when 'L' => - Ptr := Ptr + 1; - Follow_Links := True; + if Ptr /= Max then + Bad_Switch (Switch_Chars); + + else + Follow_Links := True; + end if; + + -- Processing for eS switch + + when 'S' => + if Ptr /= Max then + Bad_Switch (Switch_Chars); + + else + Commands_To_Stdout := True; + end if; when others => Bad_Switch (Switch_Chars); end case; - -- Processing for f switch - - when 'f' => + elsif C = 'j' then Ptr := Ptr + 1; - Force_Compilations := True; - -- Processing for F switch + declare + Max_Proc : Pos; + begin + Scan_Pos (Switch_Chars, Max, Ptr, Max_Proc, C); - when 'F' => - Ptr := Ptr + 1; - Full_Path_Name_For_Brief_Errors := True; + if Ptr <= Max then + Bad_Switch (Switch_Chars); - -- Processing for h switch + else + Maximum_Processes := Positive (Max_Proc); + end if; + end; - when 'h' => + elsif C = 'w' and then Switch_Chars'Length = 3 then Ptr := Ptr + 1; - Usage_Requested := True; - -- Processing for i switch + if Switch_Chars = "-we" then + Warning_Mode := Treat_As_Error; - when 'i' => - Ptr := Ptr + 1; - In_Place_Mode := True; + elsif Switch_Chars = "-wn" then + Warning_Mode := Normal; - -- Processing for j switch + elsif Switch_Chars = "-ws" then + Warning_Mode := Suppress; - when 'j' => - if Ptr = Max then - Bad_Switch (Switch_Chars); + else + Success := False; end if; - Ptr := Ptr + 1; + else + Success := False; + end if; - declare - Max_Proc : Pos; - begin - Scan_Pos (Switch_Chars, Max, Ptr, Max_Proc, C); - Maximum_Processes := Positive (Max_Proc); - end; + -- Single-character switches - -- Processing for k switch + else + Check_Switch : begin - when 'k' => - Ptr := Ptr + 1; - Keep_Going := True; + case C is - -- Processing for l switch + when 'a' => + Check_Readonly_Files := True; - when 'l' => - Ptr := Ptr + 1; - Link_Only := True; - Make_Steps := True; + -- Processing for b switch - when 'M' => - Ptr := Ptr + 1; - List_Dependencies := True; + when 'b' => + Bind_Only := True; + Make_Steps := True; - -- Processing for n switch + -- Processing for B switch - when 'n' => - Ptr := Ptr + 1; - Do_Not_Execute := True; + when 'B' => + Build_Bind_And_Link_Full_Project := True; - -- Processing for o switch + -- Processing for c switch - when 'o' => - Ptr := Ptr + 1; + when 'c' => + Compile_Only := True; + Make_Steps := True; - if Output_File_Name_Present then - Osint.Fail ("duplicate -o switch"); - else - Output_File_Name_Present := True; - end if; + -- Processing for C switch - -- Processing for q switch + when 'C' => + Create_Mapping_File := True; - when 'q' => - Ptr := Ptr + 1; - Quiet_Output := True; + -- Processing for D switch - -- Processing for R switch + when 'D' => + if Object_Directory_Present then + Osint.Fail ("duplicate -D switch"); - when 'R' => - Ptr := Ptr + 1; - Run_Path_Option := False; + else + Object_Directory_Present := True; + end if; - -- Processing for s switch + -- Processing for f switch - when 's' => - Ptr := Ptr + 1; - Check_Switches := True; + when 'f' => + Force_Compilations := True; - -- Processing for S switch + -- Processing for F switch - when 'S' => - Ptr := Ptr + 1; - Commands_To_Stdout := True; + when 'F' => + Full_Path_Name_For_Brief_Errors := True; - -- Processing for v switch + -- Processing for h switch - when 'v' => - Ptr := Ptr + 1; - Verbose_Mode := True; - Verbosity_Level := Opt.High; + when 'h' => + Usage_Requested := True; - if Ptr <= Max then - case Switch_Chars (Ptr) is - when 'l' => - Verbosity_Level := Opt.Low; + -- Processing for i switch - when 'm' => - Verbosity_Level := Opt.Medium; + when 'i' => + In_Place_Mode := True; - when 'h' => - Verbosity_Level := Opt.High; + -- Processing for j switch - when others => - Bad_Switch (Switch_Chars); - end case; + when 'j' => + -- -j not followed by a number is an error - Ptr := Ptr + 1; - end if; + Bad_Switch (Switch_Chars); - -- Processing for x switch + -- Processing for k switch - when 'x' => - Ptr := Ptr + 1; - External_Unit_Compilation_Allowed := True; + when 'k' => + Keep_Going := True; - -- Processing for z switch + -- Processing for l switch - when 'z' => - Ptr := Ptr + 1; - No_Main_Subprogram := True; + when 'l' => + Link_Only := True; + Make_Steps := True; - -- Anything else is an error (illegal switch character) + -- Processing for M switch - when others => - Bad_Switch (Switch_Chars); + when 'M' => + List_Dependencies := True; - end case; + -- Processing for n switch - if Ptr <= Max then - Bad_Switch (Switch_Chars); - end if; + when 'n' => + Do_Not_Execute := True; + + -- Processing for o switch + + when 'o' => + if Output_File_Name_Present then + Osint.Fail ("duplicate -o switch"); + else + Output_File_Name_Present := True; + end if; + + -- Processing for p switch + + when 'p' => + Setup_Projects := True; + + -- Processing for q switch + + when 'q' => + Quiet_Output := True; + + -- Processing for R switch + + when 'R' => + Run_Path_Option := False; - end Check_Switch; + -- Processing for s switch + when 's' => + Ptr := Ptr + 1; + Check_Switches := True; + + -- Processing for v switch + + when 'v' => + Verbose_Mode := True; + Verbosity_Level := Opt.High; + + -- Processing for x switch + + when 'x' => + External_Unit_Compilation_Allowed := True; + + -- Processing for z switch + + when 'z' => + No_Main_Subprogram := True; + + -- Any other small letter is an illegal switch + + when others => + if C in 'a' .. 'z' then + Bad_Switch (Switch_Chars); + + else + Success := False; + end if; + + end case; + end Check_Switch; + end if; end Scan_Make_Switches; end Switch.M; |