<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - kmp_lock.cpp doesn't compile with clang-cl"
   href="https://bugs.llvm.org/show_bug.cgi?id=49339">49339</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>kmp_lock.cpp doesn't compile with clang-cl
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>OpenMP
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Runtime Library
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>hans@chromium.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Blocks</th>
          <td>48902
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This reproduces both with the current 12.x branch and main branch (as of
abbdb5639c70d167bd66cd62296927330782c3b4)

Building the openmp runtime with clang-cl fails as below (i was doing a 32-bit
build but I'm not sure that matters):


[2212/5188] Building CXX object
projects\openmp\runtime\src\CMakeFiles\omp.dir\kmp_lock.cpp.obj
FAILED: projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_lock.cpp.obj
C:\src\llvm_package_1200-rc2\build32_stage0\bin\clang-cl.exe  /nologo -TP
-D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS
-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_FILE_OFFSET_BITS=64
-D_LARGEFILE_SOURCE -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
-Domp_EXPORTS -Iprojects\openmp\runtime\src
-IC:\src\llvm_package_1200-rc2\llvm-project\openmp\runtime\src -Iinclude
-IC:\src\llvm_package_1200-rc2\llvm-project\llvm\include
-IC:\src\llvm_package_1200-rc2\llvm-project\openmp\runtime\src\i18n
-IC:\src\llvm_package_1200-rc2\llvm-project\openmp\runtime\src\include
-IC:\src\llvm_package_1200-rc2\llvm-project\openmp\runtime\src\thirdparty\ittnotify
/DWIN32 /D_WINDOWS   /Zc:inline /Zc:__cplusplus /Zc:strictStrings /Oi
/Zc:rvalueCast /Brepro /bigobj /W4  -Wextra -Wno-unused-parameter
-Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough
-Wcovered-switch-default -Wno-noexcept-type -Wdelete-non-virtual-dtor
-Wsuggest-override -Wstring-conversion /Gw -Wcast-qual -Wformat-pedantic
-Wimplicit-fallthrough -Wsign-compare -Wno-extra -Wno-pedantic /MT /O2 /Ob2  
-D _CRT_SECURE_NO_WARNINGS -D _CRT_SECURE_NO_DEPRECATE -D _WINDOWS -D _WINNT -D
_WIN32_WINNT=0x0501 -D _USRDLL -UNDEBUG -std:c++14 -Wno-covered-switch-default
-Wno-frame-address -Wno-strict-aliasing -Wno-switch -Wno-uninitialized /GS
/EHsc -mrtm /arch:SSE2 -msse2 /showIncludes
/Foprojects\openmp\runtime\src\CMakeFiles\omp.dir\kmp_lock.cpp.obj
/Fdprojects\openmp\runtime\src\CMakeFiles\omp.dir\ -c
C:\src\llvm_package_1200-rc2\llvm-project\openmp\runtime\src\kmp_lock.cpp
C:\src\llvm_package_1200-rc2\llvm-project\openmp\runtime\src\kmp_lock.cpp(1721,9):
warning: '_XABORT_CODE' macro redefined [-Wmacro-redefined]
#define _XABORT_CODE(x) ((unsigned char)(((x) >> 24) & 0xFF))
        ^
C:\src\llvm_package_1200-rc2\build32_stage0\lib\clang\12.0.0\include\rtmintrin.h(24,9):
note: previous definition is here
#define _XABORT_CODE(x)   (((x) >> 24) & 0xFF)
        ^
C:\src\llvm_package_1200-rc2\llvm-project\openmp\runtime\src\kmp_lock.cpp(1733,21):
error: functions that differ only in their return type cannot be overloaded
static __inline int _xbegin() {
                ~~~ ^
C:\src\llvm_package_1200-rc2\build32_stage0\lib\clang\12.0.0\include\rtmintrin.h(30,1):
note: previous definition is here
_xbegin(void)
^
C:\src\llvm_package_1200-rc2\llvm-project\openmp\runtime\src\kmp_lock.cpp(1781,22):
error: redefinition of '_xend'
static __inline void _xend() {
                     ^
C:\src\llvm_package_1200-rc2\build32_stage0\lib\clang\12.0.0\include\rtmintrin.h(36,1):
note: previous definition is here
_xend(void)
^
C:\src\llvm_package_1200-rc2\llvm-project\openmp\runtime\src\kmp_lock.cpp(1798,9):
warning: '_xabort' macro redefined [-Wmacro-redefined]
#define _xabort(ARG) _asm _emit 0xc6 _asm _emit 0xf8 _asm _emit ARG
        ^
C:\src\llvm_package_1200-rc2\build32_stage0\lib\clang\12.0.0\include\rtmintrin.h(41,9):
note: previous definition is here
#define _xabort(imm) __builtin_ia32_xabort((imm))
        ^
2 warnings and 2 errors generated.</pre>
        </div>
      </p>

        <div id="referenced">
          <hr style="border: 1px dashed #969696">
          <b>Referenced Bugs:</b>
          <ul>
              <li>
                [<a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [meta] 12.0.0 Release Blockers"
   href="https://bugs.llvm.org/show_bug.cgi?id=48902">Bug 48902</a>] [meta] 12.0.0 Release Blockers
              </li>
          </ul>
        </div>
        <br>

      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>