<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 - stdatomic.h not C11 compliant with Objective C framework"
href="https://bugs.llvm.org/show_bug.cgi?id=40769">40769</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>stdatomic.h not C11 compliant with Objective C framework
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Macintosh
</td>
</tr>
<tr>
<th>OS</th>
<td>MacOS X
</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>Headers
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>theboywonder2244@yahoo.co.jp
</td>
</tr>
<tr>
<th>CC</th>
<td>craig.topper@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>On Mac OSX 10.4 (Mojave) with Apple LLVM Version 10.0.0 (clang-1000.11.45.5)
I have written my own <stdatomic.h> for multiple platforms that don't support
it. It is designed to work under all C11-compliant compilers. My own
<stdatomic.h> has a gate that says:
#ifndef __STDC_NO_ATOMICS__
# error ... error text goes here ...
#endif
As my entire source repository is a shared repository, this file is visible
during compilation on all platforms. I use "-idirafter" to make sure that any
file provided by the hosted environment gets picked up before my file.
If clang on Mac OSX is invoked on a file with ".c" extension then the hosted
environment doesn't supply <stdatomic.h>. In this case __STDC_NO_ATOMICS__ is
defined, my custom file is called, and it compiles cleanly.
However, for the Objective C framework, LLVM headers provide a <stdatomic.h>.
Inside this file is the following:
#if __STDC_HOSTED__ && __has_include_next(<stdatomic.h>)
# include_next <statomic.h>
#endif
The extension "include_next" searches "-idirafter" and sees my <stdatomic.h>
and includes it, but it does *not* define __STDC_NO_ATOMICS__ so the gate
within my custom <stdatomic.h> is entered and the build always fails. This
appears to be a violation of C2011.</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>