<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 22, 2015 at 3:17 PM, James Widman <span dir="ltr"><<a href="mailto:james.widman@gmail.com" target="_blank">james.widman@gmail.com</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 class=""><div class="h5"><br>
> On 2015-05-22, at 17:10, Sean Silva <<a href="mailto:chisophugis@gmail.com">chisophugis@gmail.com</a>> wrote:<br>
><br>
><br>
><br>
> On Fri, May 22, 2015 at 7:36 AM, Argyrios Kyrtzidis <<a href="mailto:kyrtzidis@apple.com">kyrtzidis@apple.com</a>> wrote:<br>
><br>
>> On May 20, 2015, at 5:47 PM, Thompson, John <<a href="mailto:John_Thompson@playstation.sony.com">John_Thompson@playstation.sony.com</a>> wrote:<br>
>><br>
>> The module.modulemap has the two module entries:<br>
>><br>
>>     explicit module sse4_1 {<br>
>>       requires sse41<br>
>>       export ssse3<br>
>>       header "smmintrin.h"<br>
>>     }<br>
>><br>
>>     explicit module sse4_2 {<br>
>>       requires sse42<br>
>>       export sse4_1<br>
>>       header "nmmintrin.h"<br>
>>     }<br>
>><br>
>> However, “sse41” and “sse42” in the requires don’t match the “sse4.1” and “sse4.2” target features.  This leads to error messages like:<br>
>><br>
>> 4.cpp:5:12: error: call to '_mm_blendv_ps' is ambiguous<br>
>>     return _mm_blendv_ps(x,y,z);<br>
>>            ^~~~~~~~~~~~~<br>
>> ...\lib\clang\include\smmintrin.h:103:1: note: candidate function<br>
>> _mm_blendv_ps (__m128 __V1, __m128 __V2, __m128 __M)<br>
>> ^<br>
>> ...\lib\clang\include\smmintrin.h:103:1: note: candidate function<br>
>> _mm_blendv_ps (__m128 __V1, __m128 __V2, __m128 __M)<br>
>> ^<br>
>> 1 error generated.<br>
>><br>
>> Because the ‘.’ makes the requires name an invalid identifier, either the feature name needs to change, or there needs to be some kinds of mapping or substitution done.  For example, I understand changing the feature name might be problematic, so changing the module map to use “sse4_1” and have clang replace the ‘_’ with ‘.’ before the feature check, or just map the problematic names, or decouple the “requires” names from the features names, are some possible options.  What do you think?<br>
>><br>
>> But also, this raises another issue.  The reason I get the error is because the compiler silently failed to match the requires argument, but went ahead and processed the header textually or something, leading to the confusing error.  Could we improve the error detection here?  Are there other situations where a silent failure is problematic?<br>
><br>
> The silent failure is problematic in general and we should fix this, could you file a bugzilla report to track this ?<br>
><br>
><br>
> I think this is PR23614.<br>
<br>
</div></div>This looks kind of similar to the error that I just got trying to build clang after running cmake  with:<br>
<br>
   -DLLVM_ENABLE_MODULES=ON<br>
<br>
I get:<br>
<br>
While building module 'LLVM_Utils' imported from ../lib/Support/StringRef.cpp:10:<br>
While building module 'LLVM_Support_DataTypes' imported from ../include/llvm/Support/PointerLikeTypeTraits.h:18:<br>
In file included from <module-includes>:1:<br>
In file included from include/llvm/Support/DataTypes.h:41:<br>
/usr/include/inttypes.h:293:18: error: functions that differ only in their return type cannot be overloaded<br>
extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom)<br>
       ~~~~~~~~~ ^<br>
/usr/include/inttypes.h:293:18: note: previous declaration is here<br>
extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom)<br>
       ~~~~~~~~~ ^<br>
<br>
(Complete log for the compilation of StringRef.cpp here: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__pastebin.com_Yi9J5WQ2&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=CnzuN65ENJ1H9py9XLiRvC_UQz6u3oG6GUNn7_wosSM&m=xMGeUwEN0a3ThpApP_Eiq2E-NHWwHlIJPvBoHG02qrY&s=9qTN6x0W7gwcsTKxaMX9WnpyWRMWwklVFCBE_nDXbA8&e=" target="_blank">http://pastebin.com/Yi9J5WQ2</a>)<br>
<br>
Given that LLVM_ENABLE_MODULES was added back in September, I expected this to work with Clang 3.6.<br>
<br>
Does it look like the problem is likely to be on my end, or does it look more like a bug with symptoms similar to PR23614?<br></blockquote><div><br></div><div>This is unrelated to PR23614. What you're seeing is just a very typical symptom when including textual headers (e.g. if your system headers don't have a module map). Basically, two different modules think they "own" that definition. Richard is working on some stuff right now that should avoid this issue. Right now, -fdiagnostics-show-note-include-stack is really useful for debugging the issue.</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">
<br>
host==target, which is x86_64-linux-gnu, Ubuntu 15.04, using Clang 3.6.0 from Ubuntu to compile a version of clang/LLVM that I SVN-update'd a few days ago<br>
<span class=""><font color="#888888"><br>
--James<br>
<br>
</font></span></blockquote></div><br></div></div>