[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: preparing for 2.3b
From: |
Akim Demaille |
Subject: |
Re: preparing for 2.3b |
Date: |
Thu, 28 Feb 2008 17:01:08 +0100 |
User-agent: |
Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.95 (gnu/linux) |
>>> "JED" == Joel E Denny <address@hidden> writes:
> 2. The "Option Cross Key" section says -g and -x take an optional FILE
> argument, but they don't.
They should, to match the behavior of the long option.
> It indicates that the -o argument is optional, but it's not. There
> may be other instances of each case that I didn't notice.
I addressed both issues here. There is also -d which takes no
argument, although the long option does :( I'd prefer that short and
long options have the same behavior, at least to avoid lying when we
state
Mandatory arguments to long options are mandatory for short
options too.
but I guess POSIX will make trouble? And anyway, this is likely to
break existing Makefiles :(
Index: ChangeLog
from Akim Demaille <address@hidden>
* src/getargs.c (short_options): Split and sort for readability.
-g and -x take optional arguments, just like their long options.
* build-aux/cross-options.pl: Use /x to make the regexp easier to
understand.
Fix the handling of $opt which resulted in all the argument to be
considered as optional.
Index: build-aux/cross-options.pl
===================================================================
RCS file: /cvsroot/bison/bison/build-aux/cross-options.pl,v
retrieving revision 1.2
diff -u -u -r1.2 cross-options.pl
--- build-aux/cross-options.pl 18 Nov 2007 06:40:41 -0000 1.2
+++ build-aux/cross-options.pl 28 Feb 2008 15:58:53 -0000
@@ -7,7 +7,12 @@
my %option;
while (<>)
{
- if (/^\s*(?:(-\w), )?(--[-\w]+)(\[?)(=[-\w]+)?\]?/)
+ if (/^\s* # Initial spaces.
+ (?:(-\w),\s+)? # $1: Possible short option.
+ (--[-\w]+) # $2: Long option.
+ (\[?) # $3: '[' iff the argument is optional.
+ (?:=([-\w]+))? # $4: Possible argument name.
+ /x)
{
my ($short, $long, $opt, $arg) = ($1, $2, $3, $4);
$short = defined $short ? '@option{' . $short . '}' : '';
@@ -16,7 +21,7 @@
$arg =~ s/^=//;
$arg = '@var{' . lc ($arg) . '}';
$arg = '[' . $arg . ']'
- if defined $opt;
+ if $opt eq '[';
$option{"$long=$arg"} = $short ? "$short $arg" : '';
}
else
Index: src/getargs.c
===================================================================
RCS file: /cvsroot/bison/bison/src/getargs.c,v
retrieving revision 1.104
diff -u -u -r1.104 getargs.c
--- src/getargs.c 23 Feb 2008 04:26:14 -0000 1.104
+++ src/getargs.c 28 Feb 2008 15:58:53 -0000
@@ -403,8 +403,30 @@
| Process the options. |
`----------------------*/
-/* Shorts options. */
-static char const short_options[] = "yvegxdhr:L:ltknVo:b:p:S:T::W";
+/* Shorts options.
+ Should be computed from long_options. */
+static char const short_options[] =
+ "L:"
+ "S:"
+ "T::"
+ "V"
+ "W"
+ "b:"
+ "d"
+ "e"
+ "g::"
+ "h"
+ "k"
+ "l"
+ "n"
+ "o:"
+ "p:"
+ "r:"
+ "t"
+ "v"
+ "x::"
+ "y"
+ ;
/* Values for long options that do not have single-letter equivalents. */
enum