diff gcc/ada/libgnat/g-comlin.adb @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
line wrap: on
line diff
--- a/gcc/ada/libgnat/g-comlin.adb	Fri Oct 27 22:46:09 2017 +0900
+++ b/gcc/ada/libgnat/g-comlin.adb	Thu Oct 25 07:37:49 2018 +0900
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1999-2017, Free Software Foundation, Inc.         --
+--          Copyright (C) 1999-2018, 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- --
@@ -1474,6 +1474,29 @@
       end if;
    end Define_Switch;
 
+   -------------------
+   -- Define_Switch --
+   -------------------
+
+   procedure Define_Switch
+     (Config      : in out Command_Line_Configuration;
+      Callback    : not null Value_Callback;
+      Switch      : String := "";
+      Long_Switch : String := "";
+      Help        : String := "";
+      Section     : String := "";
+      Argument    : String := "ARG")
+   is
+      Def : Switch_Definition (Switch_Callback);
+   begin
+      if Switch /= "" or else Long_Switch /= "" then
+         Initialize_Switch_Def
+           (Def, Switch, Long_Switch, Help, Section, Argument);
+         Def.Callback := Callback;
+         Add (Config, Def);
+      end if;
+   end Define_Switch;
+
    --------------------
    -- Define_Section --
    --------------------
@@ -3403,6 +3426,10 @@
                   Local_Config.Switches (Index).String_Output.all :=
                     new String'(Parameter);
                   return;
+
+               when Switch_Callback =>
+                  Local_Config.Switches (Index).Callback (Switch, Parameter);
+                  return;
             end case;
          end if;
 
@@ -3471,7 +3498,7 @@
 
       for S in Local_Config.Switches'Range loop
          case Local_Config.Switches (S).Typ is
-            when Switch_Untyped =>
+            when Switch_Untyped | Switch_Callback =>
                null;   --  Nothing to do
 
             when Switch_Boolean =>