Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for options like -std=foo #23

Open
Manu343726 opened this issue Jan 28, 2019 · 3 comments
Open

Support for options like -std=foo #23

Manu343726 opened this issue Jan 28, 2019 · 3 comments
Assignees

Comments

@Manu343726
Copy link

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

@Manu343726
Copy link
Author

Manu343726 commented Jan 28, 2019

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.

@vietjtnguyen
Copy link
Owner

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.

@vietjtnguyen vietjtnguyen self-assigned this Jan 29, 2019
@vietjtnguyen
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants