<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 14, 2015 at 3:32 PM, Richard Smith via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div class="h5">On Wed, Oct 14, 2015 at 2:03 PM, Adrian Prantl via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div><div><blockquote type="cite"><div>On Oct 14, 2015, at 11:37 AM, Adrian Prantl via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>> wrote:</div><div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><blockquote type="cite"><div>On Oct 13, 2015, at 7:43 PM, Richard Smith <<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>> wrote:</div><br><div><div dir="ltr" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div class="gmail_extra"><div class="gmail_quote">On Tue, Oct 13, 2015 at 6:54 PM, Sean Silva<span> </span><span dir="ltr"><<a href="mailto:chisophugis@gmail.com" target="_blank">chisophugis@gmail.com</a>></span><span> </span>wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div>On Tue, Oct 13, 2015 at 6:14 PM, Richard Smith<span> </span><span dir="ltr"><<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>></span><span> </span>wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div>On Tue, Oct 13, 2015 at 5:31 PM, Sean Silva<span> </span><span dir="ltr"><<a href="mailto:chisophugis@gmail.com" target="_blank">chisophugis@gmail.com</a>></span><span> </span>wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div>On Tue, Oct 13, 2015 at 3:17 PM, Richard Smith via cfe-commits<span> </span><span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span><span> </span>wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span>On Tue, Oct 13, 2015 at 2:10 PM, Adrian Prantl via cfe-commits<span> </span><span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span><span> </span>wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi Richard,<br><br>this commit appears to break the module self-host on Darwin.<br><br>When compiling the following program generated by clang’s own cmake script:<br><br>> #undef NDEBUG<br>> #include <cassert><br>> #define NDEBUG<br>> #include <cassert><br>> int main() { assert(this code is not compiled); }<br><br>with clang++ -std=c++11 -fmodules -fcxx-modules test.cpp<br></blockquote><div><br></div></span><div>(You don't need -fcxx-modules here.)</div><span><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">I get<br><br>> While building module 'std' imported from /Users/buildslave/adrian/<a href="http://llvm.org/_build.ninja.release/include/c++/v1/cassert:20" rel="noreferrer" target="_blank">llvm.org/_build.ninja.release/bin/../include/c++/v1/cassert:20</a>:<br>> While building module 'Darwin' imported from /Users/buildslave/adrian/<a href="http://llvm.org/_build.ninja.release/include/c++/v1/cstddef:39" rel="noreferrer" target="_blank">llvm.org/_build.ninja.release/bin/../include/c++/v1/cstddef:39</a>:<br>> In file included from <module-includes>:98:<br>> In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/wchar.h:92:<br>> In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/_wctype.h:57:</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">> /Users/buildslave/adrian/<a href="http://llvm.org/_build.ninja.release/include/c++/v1/ctype.h:33:10" rel="noreferrer" target="_blank">llvm.org/_build.ninja.release/bin/../include/c++/v1/ctype.h:33:10</a>: fatal error: cyclic dependency in module 'std': std -> Darwin -> std<br>> #include <__config><br>>          ^<br>> While building module 'std' imported from /Users/buildslave/adrian/<a href="http://llvm.org/_build.ninja.release/include/c++/v1/cassert:20" rel="noreferrer" target="_blank">llvm.org/_build.ninja.release/bin/../include/c++/v1/cassert:20</a>:<br>> In file included from <module-includes>:1:<br>> In file included from /Users/buildslave/adrian/<a href="http://llvm.org/_build.ninja.release/include/c++/v1/algorithm:624" rel="noreferrer" target="_blank">llvm.org/_build.ninja.release/bin/../include/c++/v1/algorithm:624</a>:<br>> In file included from /Users/buildslave/adrian/<a href="http://llvm.org/_build.ninja.release/include/c++/v1/initializer_list:47" rel="noreferrer" target="_blank">llvm.org/_build.ninja.release/bin/../include/c++/v1/initializer_list:47</a>:<br>> /Users/buildslave/adrian/<a href="http://llvm.org/_build.ninja.release/include/c++/v1/cstddef:39:10" rel="noreferrer" target="_blank">llvm.org/_build.ninja.release/bin/../include/c++/v1/cstddef:39:10</a>: fatal error: could not build module 'Darwin'<br>> #include <stddef.h><br>>  ~~~~~~~~^<br>> In file included from test.cpp:2:<br>> /Users/buildslave/adrian/<a href="http://llvm.org/_build.ninja.release/include/c++/v1/cassert:20:10" rel="noreferrer" target="_blank">llvm.org/_build.ninja.release/bin/../include/c++/v1/cassert:20:10</a>: fatal error: could not build module 'std'<br>> #include <__config><br>>  ~~~~~~~~^<br>> 3 errors generated.<br><br>Let me know how I can help in diagnosing what’s going on here.<br></blockquote><div><br></div></span><div>OK, I see what's wrong. Is this working any better for you in r250236?</div></div></div></div></blockquote><div><br></div></div></div><div>We're still seeing:</div><div><br></div><div><div>While building module 'Darwin' imported from /usr/include/assert.h:42:</div><div>While building module 'std' imported from /path/to/build_cmake/stage1/bin/../include/c++/v1/math.h:309:</div></div></div></div></div></blockquote><div><br></div></div></div><div>Argh, this is including <type_traits>, which is in the std module. Can you try removing the header "type_traits" line from the libc++ module map and see if that helps?</div></div></div></div></blockquote><div><br></div></div></div><div>I've run into this issue in the past, and I don't think that will fix it (see below). Just to be sure, here is the output with type_traits removed from the module map::</div><div><br></div><div><span><div>While building module 'Darwin' imported from /usr/include/assert.h:42:</div></span><div>While building module 'std' imported from /path/to/build_cmake/stage1/bin/../include/c++/v1/type_traits:211:</div></div></div></div></div></blockquote><div><br></div><div>That's an include of <cstddef>. We'd need to apply this workaround to that header too (but I think the buck stops there).</div></div></div></div></div></blockquote><div><br></div><div>After commenting out the cstddef module as well, the test case compiles again. Should I commit that and the type_traits change to libcxx, or are you working on a better fix?</div></div></div></blockquote><div><br></div></div></div><div>To answer my previous question, removing the type_traits module allows us to finish all the cmake checks, but it then fails when building the LLVM_Utils module:</div><div><br></div><div><div style="margin:0px;line-height:normal;font-family:Menlo;font-size:11px">While building module 'LLVM_Utils' imported from ../lib/Support/APFloat.cpp:15:</div><span><div style="margin:0px;line-height:normal;font-family:Menlo;font-size:11px">In file included from <module-includes>:1:</div></span><div style="margin:0px;line-height:normal;font-family:Menlo;font-size:11px">In file included from ../include/llvm/ADT/APFloat.h:20:</div><div style="margin:0px;line-height:normal;font-family:Menlo;font-size:11px">In file included from ../include/llvm/ADT/APInt.h:19:</div><div style="margin:0px;line-height:normal;font-family:Menlo;font-size:11px">In file included from ../include/llvm/ADT/ArrayRef.h:14:</div><div style="margin:0px;line-height:normal;font-family:Menlo;font-size:11px">In file included from ../include/llvm/ADT/SmallVector.h:17:</div><div style="margin:0px;line-height:normal;font-family:Menlo;font-size:11px"><b>../include/llvm/ADT/iterator_range.h:63:36: </b><span style="color:#c33720"><b>error: </b></span><b>declaration of 'declval' must be imported from module 'Darwin.C.tgmath' before it is required</b></div><div style="margin:0px;line-height:normal;font-family:Menlo;font-size:11px">iterator_range<decltype(begin(std::declval<T>()))> drop_begin(T &&t, int n) {</div><div style="margin:0px;line-height:normal;font-family:Menlo;color:rgb(52,189,38);font-size:11px"><b>                                   ^</b></div><div style="margin:0px;line-height:normal;font-family:Menlo;font-size:11px"><b>/Users/buildslave/adrian/<a href="http://llvm.org/_build.ninja.release/bin/../include/c++/v1/type_traits:700:1:" target="_blank">llvm.org/_build.ninja.release/bin/../include/c++/v1/type_traits:700:1:</a> note: </b>previous declaration is here</div><div style="margin:0px;line-height:normal;font-family:Menlo;font-size:11px">declval() _NOEXCEPT;</div><div style="margin:0px;line-height:normal;font-family:Menlo;color:rgb(52,189,38);font-size:11px"><b>^</b></div></div></div></div></blockquote><div><br></div></div></div><div>Can you try adding -fmodules-local-submodule-visibility to your CXXFLAGS?</div><span class=""><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div><div style="margin:0px;line-height:normal;font-family:Menlo;font-size:11px">While building module 'LLVM_Utils' imported from ../lib/Support/APFloat.cpp:15:</div><span><div style="margin:0px;line-height:normal;font-family:Menlo;font-size:11px">In file included from <module-includes>:1:</div></span><div style="margin:0px;line-height:normal;font-family:Menlo;font-size:11px">In file included from ../include/llvm/ADT/APFloat.h:20:</div><div style="margin:0px;line-height:normal;font-family:Menlo;font-size:11px">In file included from ../include/llvm/ADT/APInt.h:19:</div><div style="margin:0px;line-height:normal;font-family:Menlo;font-size:11px">In file included from ../include/llvm/ADT/ArrayRef.h:14:</div><div style="margin:0px;line-height:normal;font-family:Menlo;font-size:11px">In file included from ../include/llvm/ADT/SmallVector.h:20:</div><div style="margin:0px;line-height:normal;font-family:Menlo;font-size:11px">In file included from ../include/llvm/Support/MathExtras.h:21:</div><div style="margin:0px;line-height:normal;font-family:Menlo;font-size:11px"><b>/Users/buildslave/adrian/<a href="http://llvm.org/_build.ninja.release/bin/../include/c++/v1/type_traits:220:8:" target="_blank">llvm.org/_build.ninja.release/bin/../include/c++/v1/type_traits:220:8:</a> </b><span style="color:#c33720"><b>error: </b></span><b>redefinition of '__void_t'</b></div><div style="margin:0px;line-height:normal;font-family:Menlo;font-size:11px">struct __void_t { typedef void type; };</div><div style="margin:0px;line-height:normal;font-family:Menlo;color:rgb(52,189,38);font-size:11px"><b>       ^</b></div><div style="margin:0px;line-height:normal;font-family:Menlo;font-size:11px"><b>/Users/buildslave/adrian/<a href="http://llvm.org/_build.ninja.release/bin/../include/c++/v1/type_traits:220:8:" target="_blank">llvm.org/_build.ninja.release/bin/../include/c++/v1/type_traits:220:8:</a> note: </b>previous definition is here</div><div style="margin:0px;line-height:normal;font-family:Menlo;font-size:11px">struct __void_t { typedef void type; };</div><div style="margin:0px;line-height:normal;font-family:Menlo;color:rgb(52,189,38);font-size:11px"><b>       ^</b></div><div>If there is a way to prevent Clang from going into std when building Darwin, it looks like that’d be the way to go.</div></div></div></div></blockquote><div><br></div></span><div>There is no such way currently, but we could add one. The question is, is it OK that newer versions of libc++ would only work with newer versions of Clang if modules are enabled? I'm inclined to think this is fine, since Clang's modules support is still advertised as being experimental, but if (say) you or the Sony folks tell me you need new versions of libc++ to work with some already-shipped Clang binary then we'll need to reconsider.</div></div></div></div></blockquote><div><br></div><div>From our side, we don't use libc++ right now, so changes in the libc++ tree don't affect PS4-targeting compiles. Right now our interest is self-hosting with modules enabled for e.g. build speedups.</div><div><br></div><div>-- Sean Silva</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div class="h5"><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div><div>-- adrian<blockquote type="cite"><div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><blockquote type="cite"><div><div dir="ltr" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div class="gmail_extra"><div class="gmail_quote"><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><span><div>In file included from <module-includes>:1:</div><div>In file included from /path/to/build_cmake/stage1/bin/../include/c++/v1/algorithm:624:</div><div>In file included from /path/to/build_cmake/stage1/bin/../include/c++/v1/initializer_list:47:</div><div>In file included from /path/to/build_cmake/stage1/bin/../include/c++/v1/cstddef:43:</div><div>/path/to/build_cmake/stage1/bin/../include/c++/v1/stddef.h:46:15: fatal error: cyclic dependency in module 'Darwin': Darwin -> std -> Darwin</div><div>#include_next <stddef.h></div><div>             <span> </span>^</div><div>While building module 'Darwin' imported from /usr/include/assert.h:42:</div><div>In file included from <module-includes>:80:</div><div>In file included from /path/to/build_cmake/stage1/bin/../lib/clang/3.8.0/include/tgmath.h:29:</div></span><div>In file included from /path/to/build_cmake/stage1/bin/../include/c++/v1/math.h:309:</div><div>/path/to/build_cmake/stage1/bin/../include/c++/v1/type_traits:211:10: fatal error: could not build module 'std'</div><div>#include <cstddef></div><span><div> ~~~~~~~~^</div><div>In file included from modules.cpp:2:</div><div>In file included from /path/to/build_cmake/stage1/bin/../include/c++/v1/cassert:21:</div><div>/usr/include/assert.h:42:10: fatal error: could not build module 'Darwin'</div><div>#include <sys/cdefs.h></div><div> ~~~~~~~~^</div><div>3 errors generated.</div></span></div><div> </div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br></div><span><div>What we really need here is a way to get the Darwin blah.h headers to only include each other, and not find the libc++ headers. Do you need something that works with new libc++ and old Clang, or would a Clang feature to prevent the Darwin module from finding the std module's headers work for you?</div></span></div></div></div></blockquote><div><br></div><div>I've run into this issue in the wild with the modularized PS4 SDK, so I think that a clang feature that prevents this is the best fit. I think I may have already mentioned this to you at one of the socials but just to have it in writing here for everybody else, the root cause of the issue is that `-Imylib` will cause mylib/assert.h to be selected for `#include <assert.h>`, even when building the system module. Hence some random user header will end up as being part of the system module and the seed for problems has been planted.</div><div><br></div><div>If the random user header then ends up including code from a module that depends on the system module, then clang will go off and build this other module, which itself (say) depends on the system module, which triggers the recursive dependency error.</div><div><br></div><div>There's nothing special about system headers for this issue, but due to their position at the root of the dependency tree they seem to be the ones affected in practice. The fundamental problem is that some random header outside the module is interposing for the header listed in the module map. I think the feature basically needs to be about making the module more "hermetically sealed" in this scenario. Off the top of my head, maybe something like putting the module map's directory at the front of the search path for includes? That seems sort of hacky. Any ideas?</div></div></div></div></blockquote><div><br></div><div>I was thinking: if we found the module map for a module in some include path, then we should build that module with only the directories from the header search path at or before that directory in the list of include dirs. That's probably a fairly simple change.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span><font color="#888888"><div>-- Sean Silva</div></font></span><div><div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><span><div>In file included from <module-includes>:1:</div></span><div>In file included from /path/to/build_cmake/stage1/bin/../include/c++/v1/algorithm:624:</div><div>In file included from /path/to/build_cmake/stage1/bin/../include/c++/v1/initializer_list:47:</div><div>In file included from /path/to/build_cmake/stage1/bin/../include/c++/v1/cstddef:43:</div><div>/path/to/build_cmake/stage1/bin/../include/c++/v1/stddef.h:46:15: fatal error: cyclic dependency in module 'Darwin': Darwin -> std -> Darwin</div><div>#include_next <stddef.h></div><div>             <span> </span>^</div><div>While building module 'Darwin' imported from /usr/include/assert.h:42:</div><div>In file included from <module-includes>:80:</div><div>In file included from /path/to/build_cmake/stage1/bin/../lib/clang/3.8.0/include/tgmath.h:29:</div><div>/path/to/build_cmake/stage1/bin/../include/c++/v1/math.h:309:10: fatal error: could not build module 'std'</div><div>#include <type_traits></div><div> ~~~~~~~~^</div><div>In file included from modules.cpp:2:</div><div>In file included from /path/to/build_cmake/stage1/bin/../include/c++/v1/cassert:21:</div><div>/usr/include/assert.h:42:10: fatal error: could not build module 'Darwin'</div><div>#include <sys/cdefs.h></div><div> ~~~~~~~~^</div><div>3 errors generated.</div></div><div><br></div><div><br></div><div>Looks like the system headers are being interposed.</div><span><font color="#888888"><div><br></div><div>-- Sean Silva</div></font></span><div><div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Once this works, I’d like to to set up a green dragon bot that builds clang with LLVM_ENABLE_MODULES to catch similar problems earlier.<br><br>-- adrian<br><div><div><br>> On Oct 8, 2015, at 1:36 PM, Richard Smith via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>> wrote:<br>><br>> Author: rsmith<br>> Date: Thu Oct  8 15:36:30 2015<br>> New Revision: 249738<br>><br>> URL:<span> </span><a href="http://llvm.org/viewvc/llvm-project?rev=249738&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=249738&view=rev</a><br>> Log:<br>> Split <ctype.h> out of <cctype>.<br>><br>> Added:<br>>    libcxx/trunk/include/ctype.h<br>>      - copied, changed from r249736, libcxx/trunk/include/cctype<br>> Modified:<br>>    libcxx/trunk/include/cctype<br>>    libcxx/trunk/test/std/strings/c.strings/cctype.pass.cpp<br>><br>> Modified: libcxx/trunk/include/cctype<br>> URL:<span> </span><a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/cctype?rev=249738&r1=249737&r2=249738&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/cctype?rev=249738&r1=249737&r2=249738&view=diff</a><br>> ==============================================================================<br>> --- libcxx/trunk/include/cctype (original)<br>> +++ libcxx/trunk/include/cctype Thu Oct  8 15:36:30 2015<br>> @@ -37,10 +37,6 @@ int toupper(int c);<br>><br>> #include <__config><br>> #include <ctype.h><br>> -#if defined(_LIBCPP_MSVCRT)<br>> -#include "support/win32/support.h"<br>> -#include "support/win32/locale_win32.h"<br>> -#endif // _LIBCPP_MSVCRT<br>><br>> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)<br>> #pragma GCC system_header<br>> @@ -48,33 +44,19 @@ int toupper(int c);<br>><br>> _LIBCPP_BEGIN_NAMESPACE_STD<br>><br>> -#undef isalnum<br>> using ::isalnum;<br>> -#undef isalpha<br>> using ::isalpha;<br>> -#undef isblank<br>> using ::isblank;<br>> -#undef iscntrl<br>> using ::iscntrl;<br>> -#undef isdigit<br>> using ::isdigit;<br>> -#undef isgraph<br>> using ::isgraph;<br>> -#undef islower<br>> using ::islower;<br>> -#undef isprint<br>> using ::isprint;<br>> -#undef ispunct<br>> using ::ispunct;<br>> -#undef isspace<br>> using ::isspace;<br>> -#undef isupper<br>> using ::isupper;<br>> -#undef isxdigit<br>> using ::isxdigit;<br>> -#undef tolower<br>> using ::tolower;<br>> -#undef toupper<br>> using ::toupper;<br>><br>> _LIBCPP_END_NAMESPACE_STD<br>><br>> Copied: libcxx/trunk/include/ctype.h (from r249736, libcxx/trunk/include/cctype)<br>> URL:<span> </span><a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/ctype.h?p2=libcxx/trunk/include/ctype.h&p1=libcxx/trunk/include/cctype&r1=249736&r2=249738&rev=249738&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/ctype.h?p2=libcxx/trunk/include/ctype.h&p1=libcxx/trunk/include/cctype&r1=249736&r2=249738&rev=249738&view=diff</a><br>> ==============================================================================<br>> --- libcxx/trunk/include/cctype (original)<br>> +++ libcxx/trunk/include/ctype.h Thu Oct  8 15:36:30 2015<br>> @@ -1,5 +1,5 @@<br>> // -*- C++ -*-<br>> -//===---------------------------- cctype ----------------------------------===//<br>> +//===---------------------------- ctype.h ---------------------------------===//<br>> //<br>> //                     The LLVM Compiler Infrastructure<br>> //<br>> @@ -8,14 +8,11 @@<br>> //<br>> //===----------------------------------------------------------------------===//<br>><br>> -#ifndef _LIBCPP_CCTYPE<br>> -#define _LIBCPP_CCTYPE<br>> +#ifndef _LIBCPP_CTYPE_H<br>> +#define _LIBCPP_CTYPE_H<br>><br>> /*<br>> -    cctype synopsis<br>> -<br>> -namespace std<br>> -{<br>> +    ctype.h synopsis<br>><br>> int isalnum(int c);<br>> int isalpha(int c);<br>> @@ -31,52 +28,41 @@ int isupper(int c);<br>> int isxdigit(int c);<br>> int tolower(int c);<br>> int toupper(int c);<br>> -<br>> -}  // std<br>> */<br>><br>> #include <__config><br>> -#include <ctype.h><br>> -#if defined(_LIBCPP_MSVCRT)<br>> -#include "support/win32/support.h"<br>> -#include "support/win32/locale_win32.h"<br>> -#endif // _LIBCPP_MSVCRT<br>> +#include_next <ctype.h><br>><br>> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)<br>> #pragma GCC system_header<br>> #endif<br>><br>> -_LIBCPP_BEGIN_NAMESPACE_STD<br>> +#ifdef __cplusplus<br>> +<br>> +#if defined(_LIBCPP_MSVCRT)<br>> +// We support including .h headers inside 'extern "C"' contexts, so switch<br>> +// back to C++ linkage before including these C++ headers.<br>> +extern "C++" {<br>> +  #include "support/win32/support.h"<br>> +  #include "support/win32/locale_win32.h"<br>> +}<br>> +#endif // _LIBCPP_MSVCRT<br>><br>> #undef isalnum<br>> -using ::isalnum;<br>> #undef isalpha<br>> -using ::isalpha;<br>> #undef isblank<br>> -using ::isblank;<br>> #undef iscntrl<br>> -using ::iscntrl;<br>> #undef isdigit<br>> -using ::isdigit;<br>> #undef isgraph<br>> -using ::isgraph;<br>> #undef islower<br>> -using ::islower;<br>> #undef isprint<br>> -using ::isprint;<br>> #undef ispunct<br>> -using ::ispunct;<br>> #undef isspace<br>> -using ::isspace;<br>> #undef isupper<br>> -using ::isupper;<br>> #undef isxdigit<br>> -using ::isxdigit;<br>> #undef tolower<br>> -using ::tolower;<br>> #undef toupper<br>> -using ::toupper;<br>><br>> -_LIBCPP_END_NAMESPACE_STD<br>> +#endif<br>><br>> -#endif  // _LIBCPP_CCTYPE<br>> +#endif  // _LIBCPP_CTYPE_H<br>><br>> Modified: libcxx/trunk/test/std/strings/c.strings/cctype.pass.cpp<br>> URL:<span> </span><a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/c.strings/cctype.pass.cpp?rev=249738&r1=249737&r2=249738&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/c.strings/cctype.pass.cpp?rev=249738&r1=249737&r2=249738&view=diff</a><br>> ==============================================================================<br>> --- libcxx/trunk/test/std/strings/c.strings/cctype.pass.cpp (original)<br>> +++ libcxx/trunk/test/std/strings/c.strings/cctype.pass.cpp Thu Oct  8 15:36:30 2015<br>> @@ -86,18 +86,18 @@ int main()<br>>     static_assert((std::is_same<decltype(std::tolower(0)), int>::value), "");<br>>     static_assert((std::is_same<decltype(std::toupper(0)), int>::value), "");<br>><br>> -    assert(isalnum('a'));<br>> -    assert(isalpha('a'));<br>> -    assert(isblank(' '));<br>> -    assert(!iscntrl(' '));<br>> -    assert(!isdigit('a'));<br>> -    assert(isgraph('a'));<br>> -    assert(islower('a'));<br>> -    assert(isprint('a'));<br>> -    assert(!ispunct('a'));<br>> -    assert(!isspace('a'));<br>> -    assert(!isupper('a'));<br>> -    assert(isxdigit('a'));<br>> -    assert(tolower('A') == 'a');<br>> -    assert(toupper('a') == 'A');<br>> +    assert(std::isalnum('a'));<br>> +    assert(std::isalpha('a'));<br>> +    assert(std::isblank(' '));<br>> +    assert(!std::iscntrl(' '));<br>> +    assert(!std::isdigit('a'));<br>> +    assert(std::isgraph('a'));<br>> +    assert(std::islower('a'));<br>> +    assert(std::isprint('a'));<br>> +    assert(!std::ispunct('a'));<br>> +    assert(!std::isspace('a'));<br>> +    assert(!std::isupper('a'));<br>> +    assert(std::isxdigit('a'));<br>> +    assert(std::tolower('A') == 'a');<br>> +    assert(std::toupper('a') == 'A');<br>> }<br>><br>><br>> _______________________________________________<br>> cfe-commits mailing list<br>><span> </span><a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>><span> </span><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br><br>_______________________________________________<br>cfe-commits mailing list<br><a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br></div></div></blockquote></div></div></div><br></div></div><br>_______________________________________________<br>cfe-commits mailing list<br><a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a></blockquote></div></div></div></div></div></blockquote></div></div></div></div></div></blockquote></div></div></div></div></div></blockquote></div></div></div></div></blockquote></div><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">_______________________________________________</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">cfe-commits mailing list</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><a href="mailto:cfe-commits@lists.llvm.org" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">cfe-commits@lists.llvm.org</a><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a></div></blockquote></div></div></div><br></div><br>_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
<br></blockquote></div></div></div><br></div></div>
<br>_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
<br></blockquote></div><br></div></div>