public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Do not call Callback function when switch is dealt with automatically
@ 2011-09-02  7:10 Arnaud Charlet
  0 siblings, 0 replies; only message in thread
From: Arnaud Charlet @ 2011-09-02  7:10 UTC (permalink / raw)
  To: gcc-patches; +Cc: Johannes Kanig

[-- Attachment #1: Type: text/plain, Size: 381 bytes --]

This patch modifies the behavior of Getopt in GNAT.Command_Line to not call
the Callback function in argument on switches that have been dealt with
automatically.

Tested on x86_64-pc-linux-gnu, committed on trunk

2011-09-02  Johannes Kanig  <kanig@adacore.com>

	* g-comlin.adb (Getopt): Return when switch is dealt with automatically,
	instead of calling the callback function


[-- Attachment #2: difs --]
[-- Type: text/plain, Size: 1304 bytes --]

Index: g-comlin.adb
===================================================================
--- g-comlin.adb	(revision 178381)
+++ g-comlin.adb	(working copy)
@@ -3290,11 +3290,14 @@
                           with "Expected integer parameter for '"
                             & Switch & "'";
                   end;
+                  return;
 
                when Switch_String =>
                   Free (Config.Switches (Index).String_Output.all);
                   Config.Switches (Index).String_Output.all :=
                     new String'(Parameter);
+                  return;
+
             end case;
          end if;
 
Index: g-comlin.ads
===================================================================
--- g-comlin.ads	(revision 178381)
+++ g-comlin.ads	(working copy)
@@ -707,7 +707,8 @@
       Callback : Switch_Handler := null;
       Parser   : Opt_Parser := Command_Line_Parser);
    --  Similar to the standard Getopt function.
-   --  For each switch found on the command line, this calls Callback.
+   --  For each switch found on the command line, this calls Callback, if the
+   --  switch is not handled automatically.
    --
    --  The list of valid switches are the ones from the configuration. The
    --  switches that were declared through Define_Switch with an Output

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-09-02  7:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-02  7:10 [Ada] Do not call Callback function when switch is dealt with automatically Arnaud Charlet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).