<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
tt
        {mso-style-priority:99;
        font-family:"Courier New";}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0in;
        margin-right:0in;
        margin-bottom:0in;
        margin-left:.5in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        color:black;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        color:black;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:276987806;
        mso-list-type:hybrid;
        mso-list-template-ids:1476663802 1774611160 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l0:level1
        {mso-level-start-at:0;
        mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;
        mso-fareast-font-family:Calibri;
        mso-bidi-font-family:"Times New Roman";}
@list l0:level2
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:"Courier New";}
@list l0:level3
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;}
@list l0:level4
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Symbol;}
@list l0:level5
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:"Courier New";}
@list l0:level6
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;}
@list l0:level7
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Symbol;}
@list l0:level8
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:"Courier New";}
@list l0:level9
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;}
ol
        {margin-bottom:0in;}
ul
        {margin-bottom:0in;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body bgcolor="white" lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<ul style="margin-top:0in" type="disc">
<li class="MsoListParagraph" style="color:windowtext;margin-left:0in;mso-list:l0 level1 lfo1">
<span style="color:black">On the contrary, the existing proposal and implementation direction will
<b>require major and complicated build system modifications if more than a handful of modules are to be used
</b>(statically encoding additional compiler invocations can be reasonable, but doesn't scale).</span><o:p></o:p></li></ul>
<p class="MsoNormal"><span style="color:windowtext"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext">Citation needed.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext">Ben Boeckel et al’s paper might be relevant here.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext"><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="color:windowtext">From:</span></b><span style="color:windowtext"> tooling-bounces@open-std.org <tooling-bounces@open-std.org>
<b>On Behalf Of </b>Tom Honermann<br>
<b>Sent:</b> Friday, February 8, 2019 10:14 AM<br>
<b>To:</b> WG21 Tooling Study Group SG15 <tooling@open-std.org><br>
<b>Subject:</b> Re: [Tooling] Clang Modules and build system requirements<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On 2/8/19 12:58 AM, Mathias Stearn wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">On Fri, Feb 8, 2019 at 12:33 AM Tom Honermann <<a href="mailto:tom@honermann.net">tom@honermann.net</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<p class="MsoNormal">A couple of people have countered that build system updates are required (presumably in excess of just adding '-fmodules' to Clang invocations) in order to enable support for Clang Modules. This seems trivially incorrect to me, so long
as one does not consider Clang's module.modulemap files to be part of the build system (I don't; they are tool specific configuration files that the build system does not need to be aware of).
<o:p></o:p></p>
</div>
</blockquote>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I would hope you are marking the module.modulemap as an input dependency of every compilation that uses -fmodules. If you don't then you are risking silent miscompilation which is about the worst thing a build system can do. And if you
are, that means that you have either manually added it as an input edge to every compile (unlikely), or you modified your build system to teach it to do that automatically*. I assume you are primarily referring to deeper structural changes, but your implication
that you can just add -fmodules to CXXFLAGS and walk away seems trivially incorrect to me.<o:p></o:p></p>
</div>
</div>
</div>
</blockquote>
<p>Build systems that rely on the compiler to provide per-TU input dependencies are likely already covered here. For example, Clang's '-M' output includes referenced module map files:<o:p></o:p></p>
<p><tt><span style="font-size:10.0pt">$ cat m.cpp </span></tt><span style="font-size:10.0pt;font-family:"Courier New""><br>
<tt>#include <cstdio></tt></span><o:p></o:p></p>
<p><tt><span style="font-size:10.0pt">$ clang -c -M -fmodules m.cpp </span></tt><span style="font-size:10.0pt;font-family:"Courier New""><br>
<tt>m.o: m.cpp \</tt><br>
<tt> ...</tt><br>
<tt> /home/tom/products/clang-7.0.0/lib/clang/7.0.0/include/module.modulemap \</tt><br>
<tt> ...</tt></span><o:p></o:p></p>
<p>(I see from other responses that you already discovered this, but I already wrote the above so I'm sending it anyway).<o:p></o:p></p>
<p>It does look like build systems that rely on #line scanning for dependencies will currently miss the dependency as no #line indicators are emitted for module maps. Perhaps there is a reasonable enhancement request to be made to Clang here.<o:p></o:p></p>
<p>You are correct that a missed dependency on a module map file can result in a miscompilation, but the changes are low (I think the only way that can happen is if the set of exported sub-modules is changed). Missed dependencies are bad, but also something
that can be improved as QOI in the build system (I've never yet had the pleasure of working with a build system that wasn't missing some dependency edges). The point I was trying to make is that Clang modules don't require build system updates (other than
to pass '-fmodules') to continue to work more-or-less as well as they already do. On the contrary, the existing proposal and implementation direction will require major and complicated build system modifications if more than a handful of modules are to be
used (statically encoding additional compiler invocations can be reasonable, but doesn't scale).<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<div>
<div>
<p class="MsoNormal">*Technically there is an additional option: your build system monitors for every file that the compiler opens (eg by LDPRELOAD) and automatically adds the modulemap file as an input edge. But I don't think you are intending to require every
build system to do that.<o:p></o:p></p>
</div>
</div>
</div>
</blockquote>
<p>Certainly not :)<o:p></o:p></p>
<p>Tom.<o:p></o:p></p>
</div>
</div>
</body>
</html>