* [Ada] Better handling of invalid switches in GNAT.Command_Line
@ 2015-11-18 10:32 Arnaud Charlet
0 siblings, 0 replies; only message in thread
From: Arnaud Charlet @ 2015-11-18 10:32 UTC (permalink / raw)
To: gcc-patches; +Cc: Vincent Celier
[-- Attachment #1: Type: text/plain, Size: 532 bytes --]
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 <celier@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 '='.
[-- Attachment #2: difs --]
[-- Type: text/plain, Size: 1291 bytes --]
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;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-11-18 10:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-18 10:32 [Ada] Better handling of invalid switches in GNAT.Command_Line 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).