[PATCH] D135076: [Clang] Make offloading flags accept '-' and '--'

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 3 10:25:17 PDT 2022


MaskRay added a comment.

In D135076#3830989 <https://reviews.llvm.org/D135076#3830989>, @jhuber6 wrote:

> In D135076#3830972 <https://reviews.llvm.org/D135076#3830972>, @MaskRay wrote:
>
>> There are traditionally some single-dash long options (perhaps classical Mac OS style) which conflict with short options. I think nowadays we try to avoid such single-dash short options.
>> (For example, GNU ld now requires all new long options to use two-dashes, after knowing the problem with `-omagic`.)
>>
>> I can make a patch to make cc1 `-o` `Separate` instead of `JoinedOrSeparate`, which will hopefully solve your pain of specifying a misspelled `-offloat*` cc1 option without good diagnostics.
>
> If that's possible, then that would be a good solution. I figured that allowing `-ofoo` was set in stone and this was the less controversial option. Just for reference, the problem I commonly encounter with users is the following situation

A cc1 specific `Separate` `-o` only helps misspelled `-offload-*`...

>   clang foo.cu -offload-arch=sm_80 -o foo // No offload arch, the  first -o isn't observed as its replaced by the second one.

I think these users have to accept that `-offload-arch=sm_80` means `-o ffload-arch=sm_80`.
There are a number of unfortunate `Separate` short options. `-o` is among them the most used. Long options have to avoid conflicts with `-o` by not having the single-dash form.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135076/new/

https://reviews.llvm.org/D135076



More information about the cfe-commits mailing list