<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)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@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;}
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;}
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;}
span.apple-converted-space
        {mso-style-name:apple-converted-space;}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;}
.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;}
--></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 lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">I’ve tested replacing #include <name> with #include "name" for all names in the table
<a href="https://en.cppreference.com/w/cpp/freestanding">https://en.cppreference.com/w/cpp/freestanding</a> and all names in the transitive dependency closure in libcxx (e.g. __config), and except for a small gotcha in the /experimental subdirectory (where
 some need to become "../name") this passes all tests on Mac. Obviously this is a 145-file patch, a couple lines per.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Are you interested in this patch?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Olivier<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:12.0pt;color:black">From: </span></b><span style="font-size:12.0pt;color:black">libcxx-dev <libcxx-dev-bounces@lists.llvm.org> on behalf of Olivier Giroux via libcxx-dev <libcxx-dev@lists.llvm.org><br>
<b>Reply-To: </b>Olivier Giroux <OGiroux@nvidia.com><br>
<b>Date: </b>Friday, January 18, 2019 at 1:28 PM<br>
<b>To: </b>Duncan Exon Smith <dexonsmith@apple.com><br>
<b>Cc: </b>Bruno Cardoso Lopes <bruno.cardoso@gmail.com>, Libc++ Dev <libcxx-dev@lists.llvm.org><br>
<b>Subject: </b>Re: [libcxx-dev] Why does libcxx include its own files this way?<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal">Ok. If nobody stops me then I’ll make a patch. I’ve looked at it before and it’s a big patch. Would it be acceptable if I started with the Freestanding headers as a trial balloon?<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Olivier<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:12.0pt;color:black">From: </span></b><span style="font-size:12.0pt;color:black"><dexonsmith@apple.com> on behalf of Duncan Exon Smith <dexonsmith@apple.com><br>
<b>Date: </b>Friday, January 18, 2019 at 10:10 AM<br>
<b>To: </b>Olivier Giroux <OGiroux@nvidia.com><br>
<b>Cc: </b>Libc++ Dev <libcxx-dev@lists.llvm.org>, Bruno Cardoso Lopes <bruno.cardoso@gmail.com><br>
<b>Subject: </b>Re: [libcxx-dev] Why does libcxx include its own files this way?</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">+libcxx-dev, which got dropped<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">+Bruno<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><br>
<br>
<br>
<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal">On 2019 Jan  18, at 07:21, Olivier Giroux <<a href="mailto:OGiroux@nvidia.com">OGiroux@nvidia.com</a>> wrote:<o:p></o:p></p>
</div>
<p class="MsoNormal"> <o:p></o:p></p>
<div>
<div>
<p class="MsoNormal">But you agree that it does, though, right?<o:p></o:p></p>
</div>
</div>
</blockquote>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Hmm.  To be concrete, this is what I was worried about:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<blockquote style="margin-left:30.0pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<div>
<div>
<p class="MsoNormal">#!/bin/bash<br>
<br>
run() { echo "$*" >&2; "$@" || exit 1; }<br>
run mkdir -p quote<br>
run cat </dev/null >quote/type_traits<br>
run /usr/bin/printf "%s\n" \<br>
    "#include <vector>" \<br>
    "std::vector<int> g;" \<br>
    > t.cpp<br>
run clang -iquote quote -fsyntax-only t.cpp<o:p></o:p></p>
</div>
</div>
</blockquote>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<p class="MsoNormal">which should give this output:<o:p></o:p></p>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<blockquote style="margin-left:30.0pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<div>
<p class="MsoNormal">$ bash t.sh <br>
mkdir -p quote<br>
cat<br>
/usr/bin/printf %s\n #include <vector> std::vector<int> g;<br>
clang -iquote quote -fsyntax-only t.cpp<o:p></o:p></p>
</div>
</blockquote>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">(i.e., no errors)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<p class="MsoNormal">I thought if we switched to quoted "type_traits" everywhere I'd see a spew of errors.  However, I'd forgotten that quoted includes check relative to the includer *first*, before hitting the search paths.  So I was wrong here and this testcase
 doesn't expose a problem with your suggestion. <o:p></o:p></p>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">One other concern I have is that the funny #include_next dance between libc++ headers, clang headers, and libc (especially on Darwin-derived SDKs) continues work for modules.  I kind of doubt your idea would cause a problem there since
 libc++ should be the outer most layer, but it's pretty subtle and I'd want to be sure.  Bruno might be able to check that out for you if you make a patch.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Bruno, are there other concerns for modules as well?<o:p></o:p></p>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><br>
<br>
<br>
<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">That’s actually a problem that I spend a bunch of time working around in my CUDA standard library port. I don’t want to interfere with <atomic> so I make <cuda/atomic> but then that header wants to include <type_traits> instead of the <cuda/type_traits>
 that I need it to find. If it included "type_traits" instead, it would all just work.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">So I have work-arounds for that, and obviously I can also flip <> to "" in my fork, but do you want to see ""?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Makes sense?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Olivier<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<div>
<p class="MsoNormal"><b><span style="font-size:12.0pt">From:<span class="apple-converted-space"> </span></span></b><span style="font-size:12.0pt"><<a href="mailto:dexonsmith@apple.com">dexonsmith@apple.com</a>> on behalf of Duncan Exon Smith <<a href="mailto:dexonsmith@apple.com">dexonsmith@apple.com</a>><br>
<b>Date:<span class="apple-converted-space"> </span></b>Friday, January 18, 2019 at 5:46 AM<br>
<b>To:<span class="apple-converted-space"> </span></b>Olivier Giroux <<a href="mailto:OGiroux@nvidia.com">OGiroux@nvidia.com</a>><br>
<b>Cc:<span class="apple-converted-space"> </span></b>Libc++ Dev <<a href="mailto:libcxx-dev@lists.llvm.org">libcxx-dev@lists.llvm.org</a>><br>
<b>Subject:<span class="apple-converted-space"> </span></b>Re: [libcxx-dev] Why does libcxx include its own files this way?</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt">I don’t think we want Libc++ to pick up files in -iquote search paths. </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:12.0pt"><br>
On Jan 17, 2019, at 22:20, Olivier Giroux via libcxx-dev <<a href="mailto:libcxx-dev@lists.llvm.org"><span style="color:#954F72">libcxx-dev@lists.llvm.org</span></a>> wrote:</span><o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<div>
<p class="MsoNormal">Inside of libcxx, you can see #include <name> being used when the library is _<i>clearly</i>_ intending for it to find the file that #include "name" would find. I say it’s clear because, if any other file in the world were chosen, then
 the library would likely fail to compile.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">It looks to me like the use of #include <name> is an attempt to enforce a reservation on this name in the filesystem of the build machine. If true, then it’s kind of an overreach. I’d personally much rather if these sideways includes used
 #include "name" instead.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Is there a better explanation for why this is done this way?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Olivier<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="0" width="50%" align="center">
</div>
</div>
<div>
<div>
<p class="MsoNormal">This email message is for the sole use of the intended recipient(s) and may contain confidential information.  Any unauthorized review, use, disclosure or distribution is prohibited.  If you are not the intended recipient, please contact
 the sender by reply email and destroy all copies of the original message.<o:p></o:p></p>
</div>
</div>
<div>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="0" width="50%" align="center">
</div>
</div>
</div>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<div>
<p class="MsoNormal">_______________________________________________<br>
libcxx-dev mailing list<br>
<a href="mailto:libcxx-dev@lists.llvm.org"><span style="color:#954F72">libcxx-dev@lists.llvm.org</span></a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/libcxx-dev"><span style="color:#954F72">http://lists.llvm.org/cgi-bin/mailman/listinfo/libcxx-dev</span></a><o:p></o:p></p>
</div>
</div>
</blockquote>
</div>
</blockquote>
</div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
</div>
</body>
</html>