-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Description
Bugzilla Link | 40769 |
Version | trunk |
OS | MacOS X |
Reporter | LLVM Bugzilla Contributor |
CC | @asl,@topperc,@zygoloid |
Extended Description
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.