]> granicus.if.org Git - gc/commitdiff
Fix gc_allocator.h compilation by Clang
authorIvan Maidanski <ivmai@mail.ru>
Tue, 13 Aug 2019 08:05:06 +0000 (11:05 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 13 Aug 2019 08:05:06 +0000 (11:05 +0300)
Issue #273 (bdwgc).

Though clang may report __cplusplus as 201402L, it seems to be not
C++11 compliant fully.

* include/gc_allocator.h [!GC_ATTR_EXPLICIT && __clang__ && !CPPCHECK]
(GC_ATTR_EXPLICIT): Define to empty (instead of "explicit").
* tests/test_cpp.cc [!GC_ATTR_EXPLICIT && __clang__ && !CPPCHECK]
(GC_ATTR_EXPLICIT): Likewise.

include/gc_allocator.h
tests/test_cpp.cc

index 491736fadc72ac4b4584e8855ec192654ce748e7..eceb5a429144529e53295391e7b8815f1b15272e 100644 (file)
@@ -44,7 +44,7 @@
 #include <new> // for placement new and bad_alloc
 
 #ifndef GC_ATTR_EXPLICIT
-# if (__cplusplus >= 201103L) || defined(CPPCHECK)
+# if (__cplusplus >= 201103L) && !defined(__clang__) || defined(CPPCHECK)
 #   define GC_ATTR_EXPLICIT explicit
 # else
 #   define GC_ATTR_EXPLICIT /* empty */
index 4b24b25efaab6e7fd2c095324d7fed227a77df4b..9b36a3aff468fcb34723e40869719725d2b5a2e3 100644 (file)
@@ -76,7 +76,7 @@ extern "C" {
         exit( 1 ); }
 
 #ifndef GC_ATTR_EXPLICIT
-# if (__cplusplus >= 201103L) || defined(CPPCHECK)
+# if (__cplusplus >= 201103L) && !defined(__clang__) || defined(CPPCHECK)
 #   define GC_ATTR_EXPLICIT explicit
 # else
 #   define GC_ATTR_EXPLICIT /* empty */