argagg
argagg copied to clipboard
Support for options like -std=foo
Hi,
I would like to know if argagg could implement support for short options with =value syntax, like -std=c++11 of GCC and Clang
After studying your code a bit I think this could be done by also scanning short flags for an =
sign. Then if one is found assume the flag is not a combination of flags, i.e. with three flags -a
, -b
, -c
, the following is not valid -abc=foo
("No flag named abc
" error), but -a=foo
is.
This looks like a good idea since GCC supports it as is. I'll take a look at implementation, maybe this weekend.
Some notable behavior cases with GCC:
-
gcc test.c -std=c11
works fine -
gcc test.c -std c11
doesn't work, says-std
is not an option -
gcc test.c -std=foo
doesn't work either, says that-std=foo
is not an option
That seems to imply that support -long_name
like #17 mentions is a possible solution in that one doesn't make a -std
option with an argument but rather enumerates -std=c99
and -std=c11
as individual -long_name
options.
Looks like that last hypothesis regarding -std=*
options being individually enumerated options rather than an argument-receiving one is correct: https://github.com/gcc-mirror/gcc/blob/48bbcd968d172c4e59d874c5fd831bcbf54cd221/gcc/c-family/c.opt#L1937-L2101