<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Jan 19, 2019 at 11:16 PM Olivier Giroux <<a href="mailto:OGiroux@nvidia.com">OGiroux@nvidia.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">





<div lang="EN-US">
<div class="gmail-m_-5944166875014602315WordSection1">
<p class="MsoNormal">>> Are you trying to make libc++ work when another STL is first on the include path?<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Yes, this is a big part of the issue. I can’t practically replace all the host STLs, nor make all the host STLs grow accelerator support overnight. So I introduce my STL in namespace::std:: and under a <subdir/name> include path, if you
 recall, but then the libcxx self-includes go to the wrong place.</p></div></div></blockquote><div><br></div><div>A couple of questions:</div><div><br></div><div>1) why `simt::std` and not `std::simt`? ie. leading with the fact it's  a standard library.</div><div>2) How important is it that you expose `<simt/foo>` to the user? Could `<foo>` act like a header that did `#include_next <foo> #include <simt/foo>`? <br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="EN-US"><div class="gmail-m_-5944166875014602315WordSection1"><p class="MsoNormal"><u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">>> Google wraps the STL headers with their own intermediate headers that add or adjust declarations as needed<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">In a nutshell, that’s what we do too, but it’s convoluted and brittle in some cases.</p></div></div></blockquote><div><br></div><div>Can you provide an example cases where it's problematically brittle?</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="EN-US"><div class="gmail-m_-5944166875014602315WordSection1"><p class="MsoNormal"><u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Given your use-case long predates ours… it sounds like either a change like this one would have to live in our fork, or we choose to keep and maintain the redirection wrappers.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Olivier<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(181,196,223);padding:3pt 0in 0in">
<p class="MsoNormal"><b><span style="font-size:12pt;color:black">From: </span></b><span style="font-size:12pt;color:black">Eric Fiselier <<a href="mailto:eric@efcs.ca" target="_blank">eric@efcs.ca</a>><br>
<b>Date: </b>Saturday, January 19, 2019 at 7:26 PM<br>
<b>To: </b>Olivier Giroux <<a href="mailto:OGiroux@nvidia.com" target="_blank">OGiroux@nvidia.com</a>><br>
<b>Cc: </b>Duncan Exon Smith <<a href="mailto:dexonsmith@apple.com" target="_blank">dexonsmith@apple.com</a>>, Libc++ Dev <<a href="mailto:libcxx-dev@lists.llvm.org" target="_blank">libcxx-dev@lists.llvm.org</a>><br>
<b>Subject: </b>Re: [libcxx-dev] Why does libcxx include its own files this way?<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<div>
<p class="MsoNormal"><u></u> <u></u></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.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">It's not enforcing a reservation on the header name. But it's critically important that libc++'s includes are found in the <angled> include path, before almost all headers.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Otherwise our "#include_next" directives don't work.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Additionally, Google wraps the STL headers with their own intermediate headers that add or adjust declarations as needed. This depends on our internal includes<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">being picked up first for `#include <foo>`. Your change would break that.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">I'm not sure exactly what you're trying to do here. Are you trying to make libc++ work when another STL is first on the include path?<u></u><u></u></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">On Sat, Jan 19, 2019 at 11:53 AM Olivier Giroux via libcxx-dev <<a href="mailto:libcxx-dev@lists.llvm.org" target="_blank">libcxx-dev@lists.llvm.org</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<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" target="_blank">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.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Are you interested in this patch?<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Olivier<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(181,196,223);padding:3pt 0in 0in">
<p class="MsoNormal"><b><span style="font-size:12pt;color:black">From:
</span></b><span style="font-size:12pt;color:black">libcxx-dev <<a href="mailto:libcxx-dev-bounces@lists.llvm.org" target="_blank">libcxx-dev-bounces@lists.llvm.org</a>> on behalf of Olivier Giroux via libcxx-dev <<a href="mailto:libcxx-dev@lists.llvm.org" target="_blank">libcxx-dev@lists.llvm.org</a>><br>
<b>Reply-To: </b>Olivier Giroux <<a href="mailto:OGiroux@nvidia.com" target="_blank">OGiroux@nvidia.com</a>><br>
<b>Date: </b>Friday, January 18, 2019 at 1:28 PM<br>
<b>To: </b>Duncan Exon Smith <<a href="mailto:dexonsmith@apple.com" target="_blank">dexonsmith@apple.com</a>><br>
<b>Cc: </b>Bruno Cardoso Lopes <<a href="mailto:bruno.cardoso@gmail.com" target="_blank">bruno.cardoso@gmail.com</a>>, Libc++ Dev <<a href="mailto:libcxx-dev@lists.llvm.org" target="_blank">libcxx-dev@lists.llvm.org</a>><br>
<b>Subject: </b>Re: [libcxx-dev] Why does libcxx include its own files this way?</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></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?<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Olivier<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(181,196,223);padding:3pt 0in 0in">
<p class="MsoNormal"><b><span style="font-size:12pt;color:black">From:
</span></b><span style="font-size:12pt;color:black"><<a href="mailto:dexonsmith@apple.com" target="_blank">dexonsmith@apple.com</a>> on behalf of Duncan Exon Smith <<a href="mailto:dexonsmith@apple.com" target="_blank">dexonsmith@apple.com</a>><br>
<b>Date: </b>Friday, January 18, 2019 at 10:10 AM<br>
<b>To: </b>Olivier Giroux <<a href="mailto:OGiroux@nvidia.com" target="_blank">OGiroux@nvidia.com</a>><br>
<b>Cc: </b>Libc++ Dev <<a href="mailto:libcxx-dev@lists.llvm.org" target="_blank">libcxx-dev@lists.llvm.org</a>>, Bruno Cardoso Lopes <<a href="mailto:bruno.cardoso@gmail.com" target="_blank">bruno.cardoso@gmail.com</a>><br>
<b>Subject: </b>Re: [libcxx-dev] Why does libcxx include its own files this way?</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">+libcxx-dev, which got dropped<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">+Bruno<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12pt"><br>
<br>
<u></u><u></u></p>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<p class="MsoNormal">On 2019 Jan  18, at 07:21, Olivier Giroux <<a href="mailto:OGiroux@nvidia.com" target="_blank">OGiroux@nvidia.com</a>> wrote:<u></u><u></u></p>
</div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<div>
<p class="MsoNormal">But you agree that it does, though, right?<u></u><u></u></p>
</div>
</div>
</blockquote>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Hmm.  To be concrete, this is what I was worried about:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
</div>
<blockquote style="margin:5pt 0in 5pt 30pt">
<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<u></u><u></u></p>
</div>
</div>
</blockquote>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<p class="MsoNormal">which should give this output:<u></u><u></u></p>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<blockquote style="margin:5pt 0in 5pt 30pt">
<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<u></u><u></u></p>
</div>
</blockquote>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">(i.e., no errors)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></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.
<u></u><u></u></p>
<div>
<p class="MsoNormal"> <u></u><u></u></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.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Bruno, are there other concerns for modules as well?<u></u><u></u></p>
</div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12pt"><br>
<br>
<u></u><u></u></p>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<div>
<p class="MsoNormal"> <u></u><u></u></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.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></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 ""?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Makes sense?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Olivier<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(181,196,223);padding:3pt 0in 0in">
<div>
<p class="MsoNormal"><b><span style="font-size:12pt">From:<span class="gmail-m_-5944166875014602315gmail-m-2193102447038090805apple-converted-space"> </span></span></b><span style="font-size:12pt"><<a href="mailto:dexonsmith@apple.com" target="_blank">dexonsmith@apple.com</a>>
 on behalf of Duncan Exon Smith <<a href="mailto:dexonsmith@apple.com" target="_blank">dexonsmith@apple.com</a>><br>
<b>Date:<span class="gmail-m_-5944166875014602315gmail-m-2193102447038090805apple-converted-space"> </span></b>Friday, January 18, 2019 at 5:46 AM<br>
<b>To:<span class="gmail-m_-5944166875014602315gmail-m-2193102447038090805apple-converted-space"> </span></b>Olivier Giroux <<a href="mailto:OGiroux@nvidia.com" target="_blank">OGiroux@nvidia.com</a>><br>
<b>Cc:<span class="gmail-m_-5944166875014602315gmail-m-2193102447038090805apple-converted-space"> </span></b>Libc++ Dev <<a href="mailto:libcxx-dev@lists.llvm.org" target="_blank">libcxx-dev@lists.llvm.org</a>><br>
<b>Subject:<span class="gmail-m_-5944166875014602315gmail-m-2193102447038090805apple-converted-space"> </span></b>Re: [libcxx-dev] Why does libcxx include its own files this way?</span><u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12pt">I don’t think we want Libc++ to pick up files in -iquote search paths. </span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12pt"><span style="font-size:12pt"><br>
On Jan 17, 2019, at 22:20, Olivier Giroux via libcxx-dev <<a href="mailto:libcxx-dev@lists.llvm.org" target="_blank"><span style="color:rgb(149,79,114)">libcxx-dev@lists.llvm.org</span></a>> wrote:</span><u></u><u></u></p>
</div>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<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.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></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.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Is there a better explanation for why this is done this way?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Olivier<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="0" width="36%" 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.<u></u><u></u></p>
</div>
</div>
<div>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="0" width="36%" align="center">
</div>
</div>
</div>
</blockquote>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<div>
<p class="MsoNormal">_______________________________________________<br>
libcxx-dev mailing list<br>
<a href="mailto:libcxx-dev@lists.llvm.org" target="_blank"><span style="color:rgb(149,79,114)">libcxx-dev@lists.llvm.org</span></a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/libcxx-dev" target="_blank"><span style="color:rgb(149,79,114)">http://lists.llvm.org/cgi-bin/mailman/listinfo/libcxx-dev</span></a><u></u><u></u></p>
</div>
</div>
</blockquote>
</div>
</blockquote>
</div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
</div>
</div>
</div>
<p class="MsoNormal">_______________________________________________<br>
libcxx-dev mailing list<br>
<a href="mailto:libcxx-dev@lists.llvm.org" target="_blank">libcxx-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/libcxx-dev" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/libcxx-dev</a><u></u><u></u></p>
</blockquote>
</div>
</div>
</div>
</div>

</blockquote></div></div>