When the switch is ending with a '=', actual switches not followed with a space or '=' were raising Invalid_Parameter, which was mileading. This patch fixes this: exception Invalid_Switch is now raised and Full_Switch returns the full command line switch.
Tested on x86_64-pc-linux-gnu, committed on trunk 2015-11-18 Vincent Celier <cel...@adacore.com> * g-comlin.adb (Find_Longest_Matching_Switch): Do not take into account a switch ending with '=' when the actual command line switch is not followed with a space or '='.
Index: g-comlin.adb =================================================================== --- g-comlin.adb (revision 230522) +++ g-comlin.adb (working copy) @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1999-2014, Free Software Foundation, Inc. -- +-- Copyright (C) 1999-2015, 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- -- @@ -556,6 +556,10 @@ and then Switches (Index .. Last) = Arg (Arg'First .. Arg'First + Last - Index) and then Last - Index + 1 > Switch_Length + and then + (P /= Parameter_With_Space_Or_Equal + or else Arg'Last = Arg'First + Last - Index + or else Arg (Arg'First + Last - Index + 1) = '=') then Param := P; Index_In_Switches := Index;