<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 13, 2015 at 3:17 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: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 class="">On Tue, Oct 13, 2015 at 2:10 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: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 class=""><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/bin/../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/bin/../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/bin/../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/bin/../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/bin/../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/bin/../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/bin/../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/bin/../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>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>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>              ^</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><div><br></div><div>-- Sean Silva</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 class="h5"><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: <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: <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: <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: <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>
> <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>
_______________________________________________<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">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>