[vlc-commits] atomics: fix compilation with clang version < 7

Felix Paul Kühne git at videolan.org
Fri Jun 26 16:23:32 CEST 2015


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Fri Jun 26 14:43:36 2015 +0200| [45495aa458ef6856ee9eb18860706149148bb660] | committer: Felix Paul Kühne

atomics: fix compilation with clang version < 7

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=45495aa458ef6856ee9eb18860706149148bb660
---

 include/vlc_atomic.h |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/vlc_atomic.h b/include/vlc_atomic.h
index 920d9ca..b69c88f 100644
--- a/include/vlc_atomic.h
+++ b/include/vlc_atomic.h
@@ -26,6 +26,11 @@
  * Atomic operations do not require locking, but they are not very powerful.
  */
 
+/* clang version < 7 lacks the header but supports atomics - work-around */
+#if __clang__ && __clang_major__ >= 4 && !__has_include(<stdatomic.h>)
+#define __STDC_NO_ATOMICS__ 1
+#endif
+
 # ifndef __cplusplus
 #  if (__STDC_VERSION__ >= 201112L) && !defined (__STDC_NO_ATOMICS__)
 /*** Native C11 atomics ***/



More information about the vlc-commits mailing list