<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 - __clang_cuda_runtime_wrapper.h __THROW macro redefinition inconsistent with libc"
   href="https://bugs.llvm.org/show_bug.cgi?id=47869">47869</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>__clang_cuda_runtime_wrapper.h __THROW macro redefinition inconsistent with libc
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </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>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>CUDA
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>daravi@alumni.ubc.ca
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Trying to build TensorFlow with LLVM trunk, I arrived at this error

```
++ compilation of rule '//tensorflow/core/kernels/rnn:gru_ops_gpu' failed (Exit
1)
In file included from <built-in>:1:
In file included from
/opt/llvm-master/lib/clang/12.0.0/include/__clang_cuda_runtime_wrapper.h:211:
In file included from /opt/llvm-master/bin/../include/c++/v1/string.h:60:
In file included from /usr/include/string.h:431:
In file included from /usr/include/strings.h:144:
/usr/include/bits/strings_fortified.h:23:8: error: exception specification in
declaration does not match previous declaration
__NTH (bcopy (const void *__src, void *__dest, size_t __len))
       ^
/usr/include/strings.h:38:13: note: previous declaration is here
extern void bcopy (const void *__src, void *__dest, size_t __n)
```

Looking at those files I see that the macros are defined in
`/usr/include/sys/cdefs.h`. This file defines __THROW, __NTH and __NTHNL with
consistent exception specifier as they are used to declare and define the same
functions. However `__clang_cuda_runtime_wrapper.h` re-defines only the
`__THROW` macro:

```
// __THROW is redefined to be empty by device_functions_decls.h in CUDA.
Clang's
// counterpart does not do it, so we need to make it empty here to keep
// following CUDA includes happy.
#undef __THROW
#define __THROW
```

I think the other two macros should also be cleared to avoid breaking the
exception specifier consistency in libc. If you agree please let me know and I
will be glad to contribute the fix.</pre>
        </div>
      </p>


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

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