<div class="__aliyun_email_body_block"><div  style="clear:both;">Got it. So you think the better choice is to wait the decision from SG15 or authoritative conclusion from somebody, do I get your point?</div><div  style="clear:both;"><br ></div><div  style="clear:both;">From the perspective of a user, I like the GCC style more. After all, it is not easy to rememeber to add '<span  style="caret-color:#121416;color:#121416;font-family:Helvetica;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">Xclang -emit-module-interface</span>'</div><div  style="clear:both;">all the time. I would like to see if there is any comment to address the drawbacks in current command line support in GCC. </div><div  style="clear:both;"><br ></div><div  style="clear:both;">Thanks,</div><div  style="clear:both;">Chuanqi</div><div  style="clear:both;"><span  style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><br ></span></div><blockquote  style="margin-right:0;margin-top:0;margin-bottom:0;"><div  style="clear:both;"><span  style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">------------------------------------------------------------------</span></div><div  style="clear:both;"><span  style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">From:David Blaikie <dblaikie@gmail.com></span></div><div  style="clear:both;"><span  style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">Send Time:2021年10月26日(星期二) 12:47</span></div><div  style="clear:both;"><span  style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">To:chuanqi.xcq <yedeng.yd@linux.alibaba.com></span></div><div  style="clear:both;"><span  style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">Cc:Nathan Sidwell <nathan@acm.org>; Richard Smith <richard@metafoo.co.uk>; cfe-dev <cfe-dev@lists.llvm.org></span></div><div  style="clear:both;"><span  style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">Subject:Re: [cfe-dev] Make command line support for C++20 module uniform with GCC</span></div><div  style="clear:both;"><span  style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><br ></span></div><div ><div >On Mon, Oct 25, 2021 at 7:04 PM chuanqi.xcq <<a  href="mailto:yedeng.yd@linux.alibaba.com" target="_blank">yedeng.yd@linux.alibaba.com</a>> wrote:<br ></div><div  class="gmail_quote"><div ><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">Hi Blaikie,</span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><br ></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">>> This sort of interaction is probably not going to be how modules are generally built/supported<br >>> as far as I understand it - it's opaque to the build system, so may make it more difficult for the<br >>> build system to know when things need to be rebuilt, and also wouldn't support any kind of distributed<br >>> build system.<br >>> <br >>> The specifics of how GCC, Clang, (& maybe other compilers) and various build systems may end up interacting<br >>> on the command line and filesystem (module discovery outside the current build for system-installed library<br >>> dependencies) is still being discussed and debated in places like C++'s SG15 tooling working group.</span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">---</span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">Understood. My point is that we could make clang support for C++20 more friendly by adding extra default behavior.</span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">And your point is that it may not be true in distributed build system.</span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><br ></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">>> <span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">The specifics of how GCC, Clang, (& maybe other compilers) and various build systems may end up interacting on</span></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">>> the command line and filesystem (module discovery outside the current build for system-installed library dependencies) </span></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">>> </span></span>is still being discussed and debated in places like C++'s SG15 tooling working group.</div><div  style="clear:both;">---</div><div  style="clear:both;">I have a basic question about the Clang/LLVM policy. I remember that one of the policy of Clang/LLVM's command line system </div><div  style="clear:both;">is to be compatible <span  style="font-size:14.0px;">with GCC. This is basically true so that we could transfer the compiler used in various projects. </span></div><div  style="clear:both;"><span  style="font-size:14.0px;">Is this policy not true now?</span></div></div><div ><br >I wouldn't state a general policy - though compatibility's certainly been a motivating use case when Clang started out, and to some extent still is today - but it's not always a case of "if GCC did it, Clang must accept patches that match the functionality" - especially new functionality that's in flux, I think there's some room for some nuance.<br ><br >- Dave<br > </div><div ><div  style="clear:both;"><span  style="font-size:14.0px;"><br ></span></div><div  style="clear:both;"><span  style="font-size:14.0px;">Thanks,</span></div><div  style="clear:both;"><span  style="font-size:14.0px;"><br ></span></div><div  style="clear:both;"><span  style="font-size:14.0px;">Chuanqi</span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><br ></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><br ></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><br ></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">------------------------------------------------------------------</span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">From:David Blaikie <<a  href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">Send Time:2021年10月26日(星期二) 00:36</span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">To:chuanqi.xcq <<a  href="mailto:yedeng.yd@linux.alibaba.com" target="_blank">yedeng.yd@linux.alibaba.com</a>>; Nathan Sidwell <<a  href="mailto:nathan@acm.org" target="_blank">nathan@acm.org</a>>; Richard Smith <<a  href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">Cc:cfe-dev <<a  href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">Subject:Re: [cfe-dev] Make command line support for C++20 module uniform with GCC</span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><br ></span></div><div ><div >+Nathan and Richard as folks with some context here.<br ><br >On Mon, Oct 25, 2021 at 1:57 AM chuanqi.xcq via cfe-dev <<a  href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<br ></div><div  class="gmail_quote"><div ><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">Hi all,</span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><br ></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">   Recently I am playing with C++20 modules and I found that the command line support of GCC</span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">is much better than Clang. Here is an example:</span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><br ></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">```C++</span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">// say_hello.cpp<br >module;<br >#include <iostream><br >#include <string_view><br >export module Hello;<br >export void SayHello<br >  (std::string_view const &name)<br >{<br >  std::cout << "Hello " << name << "!\n";<br >}</span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">// main.cpp<br >#include <string_view><br >import Hello;<br >int main() {<br >  SayHello("world");<br >  return 0;<br >}</span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">```</span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><br ></span></div><div  style="clear:both;">To compile the example, in gcc we need:</div><div  style="clear:both;">```</div><div  style="clear:both;">g++ -std=c++20 -fmodules-ts <span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">say_hello.cpp </span>main.cpp <br ></div><div  style="clear:both;">```</div><div  style="clear:both;"><br ></div><div  style="clear:both;">And in clang, we need:</div><div  style="clear:both;">```</div><div  style="clear:both;"><p  class=" __aliyun_node_has_color" style="margin:.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;font-stretch:normal;font-size:14.0px;line-height:normal;font-family:Helvetica;color:#121416;">clang++ -std=c++20 -fmodules-ts -Xclang -emit-module-interface -c say_hello.cpp -o Hello.pcm</p><p  class=" __aliyun_node_has_color" style="margin:.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;font-stretch:normal;font-size:14.0px;line-height:normal;font-family:Helvetica;color:#121416;">clang++ -std=c++20 -fmodules-ts -fprebuilt-module-path=. main.cpp say_hello.cpp</p></div><div  style="clear:both;">```</div><div  style="clear:both;"><br ></div><div  style="clear:both;">Yeah, in clang we need to another line to emit module interface explicitly and another option</div><div  style="clear:both;">to tell the prebuilt-module-path. And in GCC, this happens by default, when GCC find it is compiling</div><div  style="clear:both;">a c++20 module, it would generate the module interface automatically to the path:</div><div  style="clear:both;">```</div><div  style="clear:both;"><div  class=" __aliyun_node_has_color" style="color:#000000;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;text-decoration:none;">gcm.cache/filename.gcm</div></div><div  style="clear:both;">```</div><div  style="clear:both;">It would create `gcm.cache` in case it doesn't exist. </div><div  style="clear:both;"><br ></div><div  style="clear:both;">And GCC would search prebuilt module interface in `gcm.cache` automatically.</div><div  style="clear:both;"><br ></div><div  style="clear:both;">It looks much more friendly to me. The intention of this mail is to ask if you think it is the right direction</div><div  style="clear:both;">to make the clang's command line support for c++20 module more like GCC. The different I see now includes:</div><div  style="clear:both;">- Generate prebuilt module interface automatically. (And generate it to a specific directory automatically)</div><div  style="clear:both;">- Have a default value for <span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#121416;font-family:Helvetica;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">prebuilt module path.</span></div></div><div ><br >This sort of interaction is probably not going to be how modules are generally built/supported as far as I understand it - it's opaque to the build system, so may make it more difficult for the build system to know when things need to be rebuilt, and also wouldn't support any kind of distributed build system.<br ><br >The specifics of how GCC, Clang, (& maybe other compilers) and various build systems may end up interacting on the command line and filesystem (module discovery outside the current build for system-installed library dependencies) is still being discussed and debated in places like C++'s SG15 tooling working group.<br ><br >That doesn't mean we can't experiment further with things like this, but I'm not sure we will/should be supporting cross-compiler interface compatibility until we are a bit more sure about what the best thing to standardize no is.<br > </div><div ><div  style="clear:both;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#121416;font-family:Helvetica;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">I am wondering if any one more familiar with the clang's command line and file system would love to </span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#121416;font-family:Helvetica;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">support this (I am not so familiar with it). Although It may take more time, I would love to support if others are busy.</span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#121416;font-family:Helvetica;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;"><br ></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#121416;font-family:Helvetica;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">Thanks,</span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#121416;font-family:Helvetica;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">Chuanqi</span></div></div>_______________________________________________<br >
cfe-dev mailing list<br ><a  href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br ><a  href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br ></div></div><div ><br ></div></div></div></div></blockquote><div ><br ></div></div>