r231787 - Allow -target= and --target options

Justin Bogner mail at justinbogner.com
Fri Mar 13 00:14:02 PDT 2015


Chandler Carruth <chandlerc at google.com> writes:
> On Wed, Mar 11, 2015 at 2:10 PM, Richard Barton <richard.barton at arm.com>
> wrote:
>> Hi Chandler
>>
>> Gabor’s patch seems uncontroversial to me and the new behaviour matches
>> many other applications using unix getopt.
>>
>> Could you say why you think it is a mistake?
>
> Because I think it is better to have a consistent syntax.
>
> While it matches some uses of getopt, it doesn't match the prevalent
> commandline flag syntax of newer command line tools where short options are
> single '-' and single character (and can be combined), but long options have
> '--', cannot be combined, and require an '='s.

FWIW, in my experience very few --option style options require '='. This
is almost always optional and a space is accepted instead.

That said, we're horribly inconsistent about which option styles we
accept for legacy and compatibility reasons. Adding every possible way
to spell an option will only increase the inconsistency, and I'd really
rather we didn't go there. For our own options we should choose a style
and stick with it.

> I don't think this makes sense as a short option as well, and I would prefer
> we have a single unambiguous spelling of the long option.
>
> We have started trying to consistently use this long-option syntax for flags
> which are very high-level flags completely handled by the clang driver such as
> '--target='. I would like to see us get more consistent in this single
> spelling rather than less consistent. The deviations from it should be to
> preserve necessary compatibility.

Exactly.

>> Do you object to relaxing the mandatory ‘=’ or allowing both single and
>> double – versions or both?
>
> Both.




More information about the cfe-commits mailing list