OSDN Git Service

2011-12-02 Thomas Quinot <quinot@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / switch.adb
index 0c761b6..f871b19 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2011, 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- --
@@ -98,6 +98,20 @@ package body Switch is
       end if;
    end Check_Version_And_Help_G;
 
+   ------------------------------------
+   -- Display_Usage_Version_And_Help --
+   ------------------------------------
+
+   procedure Display_Usage_Version_And_Help is
+   begin
+      Write_Str ("  --version   Display version and exit");
+      Write_Eol;
+
+      Write_Str ("  --help      Display usage and exit");
+      Write_Eol;
+      Write_Eol;
+   end Display_Usage_Version_And_Help;
+
    ---------------------
    -- Display_Version --
    ---------------------
@@ -148,10 +162,10 @@ package body Switch is
    begin
       return Is_Switch (Switch_Chars)
         and then
-          (Switch_Chars (First .. Last) = "-param"
-           or else Switch_Chars (First .. Last) = "dumpbase"
-           or else Switch_Chars (First .. Last) = "auxbase-strip"
-           or else Switch_Chars (First .. Last) = "auxbase");
+          (Switch_Chars (First .. Last) = "-param"        or else
+           Switch_Chars (First .. Last) = "dumpbase"      or else
+           Switch_Chars (First .. Last) = "auxbase-strip" or else
+           Switch_Chars (First .. Last) = "auxbase");
    end Is_Internal_GCC_Switch;
 
    ---------------
@@ -169,15 +183,15 @@ package body Switch is
    -----------------
 
    function Switch_Last (Switch_Chars : String) return Natural is
-      Last  : Natural := Switch_Chars'Last;
+      Last : constant Natural := Switch_Chars'Last;
    begin
       if Last >= Switch_Chars'First
         and then Switch_Chars (Last) = ASCII.NUL
       then
-         Last := Last - 1;
+         return Last - 1;
+      else
+         return Last;
       end if;
-
-      return Last;
    end Switch_Last;
 
    -----------------