[cfe-dev] Option -mtune

David Blaikie via cfe-dev cfe-dev at lists.llvm.org
Sun Apr 19 15:32:54 PDT 2020

On Sun, Apr 19, 2020 at 2:01 PM Sjoerd Meijer <Sjoerd.Meijer at arm.com> wrote:

> Thanks for your reply, and I can see that this is the only benefit of this
> no-op: if your move to Clang and if you still have -mtune set in your build
> environment, you don't get an "unknown option" error. But for me
> personally, silently ignoring things and giving the impression it works is
> worse than a simple Makefile fix, but maybe I am wrong, which is why I
> checked here on the list.

If it were a matter of correctness rather than performance, I'd agree -
silently accepting a flag & then not doing the thing would be problematic.
(eg: accepting a language version flag for an unsupported language version
& instead using a previous/other language version)

> I was guessing that a diagnostic in this case would only be value if it's
> enabled by default as I'm afraid many users won't enable it? And if you
> need to add a flag to get this diagnostic, you might as well get rid of
> -mtune?

Generally, yeah. /maybe/ other folks'll think it's worth a warning, I don't
really - but I don't have much experience with the flag in particular, or
users of it.

Perhaps you could speak to the problems this causes your users, to help
motivate the discussion/change?

- Dave

> Cheers.
> ------------------------------
> *From:* David Blaikie <dblaikie at gmail.com>
> *Sent:* 19 April 2020 20:58
> *To:* Sjoerd Meijer <Sjoerd.Meijer at arm.com>
> *Cc:* cfe-dev at lists.llvm.org Developers <cfe-dev at lists.llvm.org>
> *Subject:* Re: [cfe-dev] Option -mtune
> On Sun, Apr 19, 2020 at 12:55 PM Sjoerd Meijer via cfe-dev <
> cfe-dev at lists.llvm.org> wrote:
> Hello,
> Quick question what you think we should be doing with option -mtune.
> Problem is that it looks like we support it because it is documented, it
> can be supplied on the command line, but it is silently ignored:
>   // FIXME: Handle -mtune=.
>   (void)Args.hasArg(options::OPT_mtune_EQ);
> giving the false impression to users it is doing something is probably the
> worst of options we have
> Not /the worst/ as such, many options are added to Clang so it's command
> line compatible (in the sense that you'll get a running program that
> behaves correctly) with GCC - I imagine the commit history of this feature
> probably justifies the addition with that sort of reason.
> Seems quite reasonable for --help and web documentation to mention that
> it's a no-op/supported-for-compatibility flag.
> As for adding a warning for these sort of no-op flags, maybe? Probably
> opt-in, though.
> (we get regularly questions about this).
> We could simply remove it, or if this is too radical, issue a diagnostic
> that this is an unsupported option? Any thoughts/preferences?
> Cheers,
> Sjoerd.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20200419/846c16b8/attachment.html>

More information about the cfe-dev mailing list