-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
elsif
RTS_Specified.all /= Switch_Chars (Ptr + 4 .. Max)
then
- Osint.Fail
- ("--RTS cannot be specified multiple times");
+ Osint.Fail ("--RTS cannot be specified multiple times");
end if;
-- Valid --RTS switch
Ptr := Ptr + 1;
Operating_Mode := Check_Semantics;
- if Tree_Output then
- ASIS_Mode := True;
- end if;
+ -- Processing for C switch
+
+ when 'C' =>
+ Ptr := Ptr + 1;
+ CodePeer_Mode := True;
-- Processing for d switch
when 'D' =>
Ptr := Ptr + 1;
+ -- Scan optional integer line limit value
+
+ if Nat_Present (Switch_Chars, Max, Ptr) then
+ Scan_Nat (Switch_Chars, Max, Ptr, Sprint_Line_Limit, 'D');
+ Sprint_Line_Limit := Nat'Max (Sprint_Line_Limit, 40);
+ end if;
+
-- Note: -gnatD also sets -gnatx (to turn off cross-reference
-- generation in the ali file) since otherwise this generation
-- gets confused by the "wrong" Sloc values put in the tree.
case Switch_Chars (Ptr) is
+ -- -gnatea (initial delimiter of explicit switches)
+
+ -- All switches that come before -gnatea have been added by
+ -- the GCC driver and are not stored in the ALI file.
+ -- See also -gnatez below.
+
when 'a' =>
Store_Switch := False;
Enable_Switch_Storing;
return;
+ -- -gnateC switch (CodePeer SCIL generation)
+
+ -- Not enabled for now, keep it for later???
+ -- use -gnatd.I only for now
+
+ -- when 'C' =>
+ -- Ptr := Ptr + 1;
+ -- Generate_SCIL := True;
+
-- -gnateD switch (preprocessing symbol definition)
when 'D' =>
Store_Switch := False;
Ptr := Ptr + 1;
Full_Path_Name_For_Brief_Errors := True;
- return;
-- -gnateG (save preprocessor output)
when 'G' =>
- if Ptr < Max then
- Bad_Switch (Switch_Chars);
- end if;
-
Generate_Processed_File := True;
Ptr := Ptr + 1;
Ptr := Max + 1;
+ -- -gnatez (final delimiter of explicit switches)
+
+ -- All switches that come after -gnatez have been added by
+ -- the GCC driver and are not stored in the ALI file. See
+ -- also -gnatea above.
+
when 'z' =>
Store_Switch := False;
Disable_Switch_Storing;
Ptr := Ptr + 1;
+ -- -gnateS (generate SCO information)
+
+ -- Include Source Coverage Obligation information in ALI
+ -- files for the benefit of source coverage analysis tools
+ -- (xcov).
+
+ when 'S' =>
+ Generate_SCO := True;
+ Ptr := Ptr + 1;
+
-- All other -gnate? switches are unassigned
when others =>
Ada_Version := Ada_05;
Ada_Version_Explicit := Ada_Version;
- -- Set default warnings for -gnatg
-
- Check_Unreferenced := True;
- Check_Unreferenced_Formals := True;
- Check_Withs := True;
- Constant_Condition_Warnings := True;
- Implementation_Unit_Warnings := True;
- Ineffective_Inline_Warnings := True;
- Warn_On_Assertion_Failure := True;
- Warn_On_Assumed_Low_Bound := True;
- Warn_On_Bad_Fixed_Value := True;
- Warn_On_Constant := True;
- Warn_On_Export_Import := True;
- Warn_On_Modified_Unread := True;
- Warn_On_No_Value_Assigned := True;
- Warn_On_Non_Local_Exception := False;
- Warn_On_Obsolescent_Feature := True;
- Warn_On_Redundant_Constructs := True;
- Warn_On_Object_Renames_Function := True;
- Warn_On_Unchecked_Conversion := True;
- Warn_On_Unrecognized_Pragma := True;
+ -- Set default warnings and style checks for -gnatg
+ Set_GNAT_Mode_Warnings;
Set_GNAT_Style_Check_Options;
-- Processing for G switch
Ptr := Ptr + 1;
Print_Generated_Code := True;
+ -- Scan optional integer line limit value
+
+ if Nat_Present (Switch_Chars, Max, Ptr) then
+ Scan_Nat (Switch_Chars, Max, Ptr, Sprint_Line_Limit, 'G');
+ Sprint_Line_Limit := Nat'Max (Sprint_Line_Limit, 40);
+ end if;
+
-- Processing for h switch
when 'h' =>
when 'j' =>
Ptr := Ptr + 1;
-
- -- There may be an equal sign between -gnatj and the value
-
- if Ptr <= Max and then Switch_Chars (Ptr) = '=' then
- Ptr := Ptr + 1;
- end if;
-
Scan_Nat (Switch_Chars, Max, Ptr, Error_Msg_Line_Length, C);
-- Processing for k switch
when 'm' =>
Ptr := Ptr + 1;
-
- -- There may be an equal sign between -gnatm and the value
-
- if Ptr <= Max and then Switch_Chars (Ptr) = '=' then
- Ptr := Ptr + 1;
- end if;
-
- Scan_Nat (Switch_Chars, Max, Ptr, Maximum_Errors, C);
+ Scan_Nat (Switch_Chars, Max, Ptr, Maximum_Messages, C);
-- Processing for n switch
when 't' =>
Ptr := Ptr + 1;
Tree_Output := True;
-
- if Operating_Mode = Check_Semantics then
- ASIS_Mode := True;
- end if;
-
Back_Annotate_Rep_Info := True;
-- Processing for T switch
-- Processing for z switch
when 'z' =>
+ -- -gnatz must be the first and only switch in Switch_Chars,
+ -- and is a two-letter switch.
+
+ if Ptr /= Switch_Chars'First + 5
+ or else (Max - Ptr + 1) > 2
+ then
+ Osint.Fail
+ ("-gnatz* may not be combined with other switches");
+ end if;
+
+ if Ptr = Max then
+ Bad_Switch ("-gnatz");
+ end if;
+
Ptr := Ptr + 1;
- -- Allowed for compiler only if this is the only
- -- -z switch, we do not allow multiple occurrences
+ -- Only one occurrence of -gnat* is permitted
if Distribution_Stub_Mode = No_Stubs then
case Switch_Chars (Ptr) is
end case;
Ptr := Ptr + 1;
+
+ else
+ Osint.Fail ("only one -gnatz* switch allowed");
end if;
-- Processing for Z switch