[PATCH] Make the driver accept all four variants of the target option

Richard Barton richard.barton at arm.com
Thu Feb 19 04:44:38 PST 2015


> There's a consensus in the Unix world that only two such syntaxes should be
> supported:
> 
> -key value
> --key=value
> 
> We only accept those two, and not the other two. This is intentional.

Point taken, but there are counterexamples. A very quick play in my terminal shows that diff accepts the option --ifdef with either a space or = separating the argument. Same for grep and --exclude, emacs and --cursor-color.

Clang is no different either:

-mcpu=, -fdiagnostics-color= are both valid. 

--include-prefix (alias for gcc -iprefix) only accepts a space as argument separator. Similarly, --output (synonym for -o), --print-file-name, --sysroot.

--mhwdiv is available as --mhwdiv=arm, --mhwdiv arm and -mhwdiv=arm, but not as -mhwdiv arm!

> I'm curious as to why you guys need this change. Maybe, if you explain the
> reasons, we could find another, less problematic solution.

"Need" is too strong here. Our concern is out-of-box usability to people unfamiliar with the tool. If a user takes clang and passes --target arm-none-eabi or -target=arm-none-eabi they get error messages like:

clang-3.7: error: unsupported option '--target'
clang-3.7: error: no such file or directory: 'arm-none-eabi'

or 

clang-3.7: error: unknown argument: '-target=arm-none-eabi'

which is pretty poor.

It seems to me that given clang is not consistent with its application of these unix rules and that there are no gcc compatibility issues to consider, this would be a simple way to improve the situation.

Ta
Rich



> -----Original Message-----
> From: Renato Golin [mailto:renato.golin at linaro.org]
> Sent: 19 February 2015 11:59
> To: gaborb at inf.u-szeged.hu; Kristof Beyls
> Cc: Richard Barton; meadori at gmail.com; cfe-commits at cs.uiuc.edu
> Subject: Re: [PATCH] Make the driver accept all four variants of the target
> option
> 
> In http://reviews.llvm.org/D7730#126290, @richard.barton.arm wrote:
> 
> > I think that having -target=<triple> and --target <triple> only is awkward.
> >  Why have two version of the same option with different rules on whether
> they
> >  accept = or spaced arguments?
> 
> 
> Hi Richard,
> 
> There's a consensus in the Unix world that only two such syntaxes should be
> supported:
> 
> -key value
> --key=value
> 
> We only accept those two, and not the other two. This is intentional.
> 
> > I think Gabor's patch makes sense as it does not break any backwards
> 
> >  compatibility within clang itself and will only help people using the tool.
> 
> 
> I agree that backwards compatibility is important, but forwards compatibility
> is equally so. Every new flag you add will create a backwards compatibility
> problem for you in the future, as well as forcing us to accept multiple flags on
> all our other tools (such as llc, lli, etc).
> 
> I'm curious as to why you guys need this change. Maybe, if you explain the
> reasons, we could find another, less problematic solution.
> 
> cheers,
> --renato
> 
> 
> REPOSITORY
>   rL LLVM
> 
> http://reviews.llvm.org/D7730
> 
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
> 
> 








More information about the cfe-commits mailing list