public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: "chuanqi.xcq" <yedeng.yd@linux.alibaba.com>
Cc: David Blaikie <dblaikie@gmail.com>,
	gcc Mailing List <gcc@gcc.gnu.org>,
	Iain Sandoe <iain@sandoe.co.uk>,
	 Nathan Sidwell <nathanmsidwell@gmail.com>,
	"ben.boeckel" <ben.boeckel@kitware.com>
Subject: Re: Naming flag for specifying the output file name for Binary Module Interface files
Date: Wed, 7 Dec 2022 15:23:09 +0000	[thread overview]
Message-ID: <CAH6eHdTOXUVQ_k6FKgrS+tkPfwCJBT-toAWZBoW32__7JxfX7g@mail.gmail.com> (raw)
In-Reply-To: <b38b64fd-4bb7-417a-bc29-ad7c3ca1665e.yedeng.yd@linux.alibaba.com>

[-- Attachment #1: Type: text/plain, Size: 3097 bytes --]

On Wed, 7 Dec 2022, 02:30 chuanqi.xcq via Gcc, <gcc@gcc.gnu.org> wrote:

> Hi Nathan,
> > 1) 'save' -- does it *cause* the bmi to be saved, or is that actually
> controlled
> by other options? (I suspect the latter)
> Yes, it causes the bmi to be saved. In fact, when we add `-save-temps`
> option in clang and we compile a module unit, we'll see the preprocessed
> output, the bmi, the LLVM IR and the assembly code. So the semantics of the
> option `-fsave-std-cxx-module-file=` is to save the bmi to the specified
> output.
> > 2) 'std' -- why is this there. There's only one C++ std, with different
> variants thereof being temporally selectable.
> Since in clang we have clang c++ modules extension. It is not std one. And
> we have objective C modules in clang too. So we said `std-cxx`.
> > 3) 'cxx' -- why not 'c++'? Let's not let this transliteration of + to x
> get
> into the options -- it hasn't in '-std=c++20' for example.
> `c++` should be good advice.
> > Might I suggest something more like '-fmodule-output='? That collates
> nicely with other -fmodule-$FOO options, and the 'output' part is similar
> to the mnemonic '-o' for the regular output file naming.
> My previous concern was there were tons of `-fmodule-*` options in clang,
> which are not standard c++ modules. So I was afraid the name
> `-fmodule-output` may be confusing.
> So I proposed `-fsave-std-cxx-module-file=`. But I didn't recognize we
> need to keep the option consistency between gcc and clang until Iain
> mentioned it.
> It is obviously redundant for gcc to keep the `-std-cxx` prefix in the
> name. Personally, I feel the clearity of the option name is more important
> than the length.
>

I disagree. I can easily remember "module output" but I would have to check
the manual every time to see if it's "std c++ module save file" or some
other permutation of those words

And if the flag is not consistent between clang and GCC that's even worse.

Since I think such flags will be mainly used by build systems/build scripts
> so such flags wouldn't be typed frequently.
> But command line interface consistency is very important too. I know tools
> writer will hate to write tons of codes like:
> ```
> if compiler == gcc
>  ...
> elif compiler == clang
>  ...
> ```
> So I think the conclusion may be:
> (1) If gcc can tolerate the lengthy `-fsave-std-c++-module-file=` name, it
> would be best for clang.
>

IMHO that's unacceptable for GCC.


(2) If (1) is not acceptable and we love to keep the command line
> consistency, I think clang can use '-fmodule-output=' as long as we make it
> clear in the document. It will be confusing but it may be the cost clang
> need to pay for the extension (so I'll vote against strongly if someone
> want to add some other extensions)
>

Given that C++20 modules are in an ISO standard and clang modules aren't, I
think it's right that the "simple" name refers to C++20 modules, without
requiring "std-c++-modules". It also seems right that the difficulty of
distinguishing clang modules from std modules should be dealt with by
clang, not by other compilers.

  reply	other threads:[~2022-12-07 15:23 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-06 21:03 David Blaikie
2022-12-07  0:35 ` Nathan Sidwell
2022-12-07  1:45   ` Jonathan Wakely
2022-12-07  2:30   ` chuanqi.xcq
2022-12-07 15:23     ` Jonathan Wakely [this message]
2022-12-07 15:45       ` ben.boeckel
2022-12-07 16:18         ` Iain Sandoe
2022-12-07 16:29           ` ben.boeckel
2022-12-07 16:52           ` Nathan Sidwell
2022-12-07 16:58             ` Iain Sandoe
2022-12-07 17:00               ` Nathan Sidwell
2022-12-09  1:58                 ` chuanqi.xcq
2022-12-09 17:33                   ` Iain Sandoe
2022-12-09 17:43                     ` David Blaikie
2022-12-12 14:30                     ` Nathan Sidwell
2022-12-13  3:10                       ` chuanqi.xcq
2022-12-13 15:56                         ` David Blaikie
2022-12-14  9:56                           ` chuanqi.xcq
2022-12-14 18:39                             ` David Blaikie
2022-12-14 22:29                               ` Nathan Sidwell
2022-12-15  5:58                                 ` chuanqi.xcq
2022-12-15  7:37                                   ` Iain Sandoe
2022-12-15 13:21                                     ` ben.boeckel
2022-12-07 16:43       ` Nathan Sidwell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAH6eHdTOXUVQ_k6FKgrS+tkPfwCJBT-toAWZBoW32__7JxfX7g@mail.gmail.com \
    --to=jwakely.gcc@gmail.com \
    --cc=ben.boeckel@kitware.com \
    --cc=dblaikie@gmail.com \
    --cc=gcc@gcc.gnu.org \
    --cc=iain@sandoe.co.uk \
    --cc=nathanmsidwell@gmail.com \
    --cc=yedeng.yd@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).