OSDN Git Service

* parser.c (cp_parser_class_specifier): Set class location to that
[pf3gnuchains/gcc-fork.git] / gcc / ada / switch-c.adb
index f0acc45..7b19410 100644 (file)
@@ -309,6 +309,12 @@ package body Switch.C is
 
                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;
@@ -365,6 +371,7 @@ package body Switch.C is
                      return;
 
                   --  -gnateC switch (CodePeer SCIL generation)
+
                   --  Not enabled for now, keep it for later???
                   --  use -gnatd.I only for now
 
@@ -396,15 +403,10 @@ package body Switch.C is
                      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;
 
@@ -462,11 +464,27 @@ package body Switch.C is
 
                      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 =>
@@ -508,28 +526,9 @@ package body Switch.C is
                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
@@ -934,10 +933,23 @@ package body Switch.C is
             --  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
@@ -952,6 +964,9 @@ package body Switch.C is
                   end case;
 
                   Ptr := Ptr + 1;
+
+               else
+                  Osint.Fail ("only one -gnatz* switch allowed");
                end if;
 
             --  Processing for Z switch