2007-04-20 Robert Dewar <dewar@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 6 Jun 2007 10:49:42 +0000 (10:49 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 6 Jun 2007 10:49:42 +0000 (10:49 +0000)
* stylesw.ads, stylesw.adb (Set_GNAT_Style_Check): New procedure
(Set_Style_Check_Options): Recognize new -gnatyg style switch

* switch-c.adb (Scan_Front_End_Switches, case -gnatg): Set
Warn_On_Non_Local_Exception to False, to turn off warnings for
No_Exception_Propagation in ZFP runtime.
(Scan_Front_End_Switches): Fix handling of --RTS switch for non GCC
back-ends.
(Scan_Front_End_Switches): For 'g', call Set_GNAT_Style_Checks

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@125469 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/stylesw.adb
gcc/ada/stylesw.ads
gcc/ada/switch-c.adb

index b27d4e0..08a2ef7 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2006, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2007, 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- --
@@ -160,6 +160,16 @@ package body Stylesw is
       Set_Style_Check_Options ("3aAbcefhiklmnprst");
    end Set_Default_Style_Check_Options;
 
+   ----------------------------------
+   -- Set_GNAT_Style_Check_Options --
+   ----------------------------------
+
+   procedure Set_GNAT_Style_Check_Options is
+   begin
+      Reset_Style_Check_Options;
+      Set_Style_Check_Options ("3aAbcdefhiklmnprstux");
+   end Set_GNAT_Style_Check_Options;
+
    -----------------------------
    -- Set_Style_Check_Options --
    -----------------------------
@@ -250,6 +260,9 @@ package body Stylesw is
             when 'f' =>
                Style_Check_Form_Feeds            := True;
 
+            when 'g' =>
+               Set_GNAT_Style_Check_Options;
+
             when 'h' =>
                Style_Check_Horizontal_Tabs       := True;
 
@@ -360,8 +373,8 @@ package body Stylesw is
 
             when others =>
                Err_Col := Err_Col - 1;
-               Style_Msg_Buf (1 .. 21) := "invalid style switch:";
-               Style_Msg_Len := 22;
+               Style_Msg_Buf (1 .. 22) := "invalid style switch: ";
+               Style_Msg_Len := 23;
                Style_Msg_Buf (Style_Msg_Len) := C;
                OK := False;
                return;
index 85b8230..284b59d 100644 (file)
@@ -264,6 +264,10 @@ package Stylesw is
    --  This procedure is called to set the default style checking options
    --  in response to a -gnaty switch with no suboptions.
 
+   procedure Set_GNAT_Style_Check_Options;
+   --  This procedure is called to set the default style checking options
+   --  for GNAT units (as set by -gnatg or -gnatyg).
+
    Style_Msg_Buf : String (1 .. 80);
    Style_Msg_Len : Natural;
    --  Used to return
index fbc0e8f..57fd313 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 2001-2006, Free Software Foundation, Inc.         --
+--          Copyright (C) 2001-2007, 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- --
@@ -33,7 +33,7 @@ with Validsw;  use Validsw;
 with Sem_Warn; use Sem_Warn;
 with Stylesw;  use Stylesw;
 
-with GNAT.OS_Lib; use GNAT.OS_Lib;
+with System.OS_Lib; use System.OS_Lib;
 
 with System.WCh_Con; use System.WCh_Con;
 
@@ -110,11 +110,13 @@ package body Switch.C is
                Add_Src_Search_Dir (Switch_Chars (Ptr .. Max));
             end if;
 
-         --  Processing of the --RTS switch. --RTS has been modified by
-         --  gcc and is now of the form -fRTS.
+         --  Processing of the --RTS switch. --RTS may have been modified by
+         --  gcc into -fRTS (for GCC targets).
 
          elsif Ptr + 3 <= Max
-           and then Switch_Chars (Ptr .. Ptr + 3) = "fRTS"
+           and then (Switch_Chars (Ptr .. Ptr + 3) = "fRTS"
+                       or else
+                     Switch_Chars (Ptr .. Ptr + 3) = "-RTS")
          then
             Ptr := Ptr + 1;
 
@@ -127,8 +129,7 @@ package body Switch.C is
                --  it is not the first time, the same path has been specified.
 
                if RTS_Specified = null then
-                  RTS_Specified :=
-                    new String'(Switch_Chars (Ptr + 4 .. Max));
+                  RTS_Specified := new String'(Switch_Chars (Ptr + 4 .. Max));
 
                elsif
                  RTS_Specified.all /= Switch_Chars (Ptr + 4 .. Max)
@@ -469,7 +470,7 @@ package body Switch.C is
                Ada_Version := Ada_05;
                Ada_Version_Explicit := Ada_Version;
 
-               --  Set default warnings for -gnatg (same set as -gnatwa)
+               --  Set default warnings for -gnatg
 
                Check_Unreferenced           := True;
                Check_Unreferenced_Formals   := True;
@@ -483,12 +484,13 @@ package body Switch.C is
                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_Unchecked_Conversion := True;
                Warn_On_Unrecognized_Pragma  := True;
 
-               Set_Style_Check_Options ("3aAbcdefhiklmnprstux");
+               Set_GNAT_Style_Check_Options;
 
             --  Processing for G switch