From e6e5700ed633fd89563e240dff8a97ad83d52e26 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Wed, 3 Oct 2018 19:04:02 +0200 Subject: [PATCH] Fix warning caused by clang defining _GNUC_ --- libretroshare/src/file_sharing/p3filelists.cc | 12 ++++++++++-- libretroshare/src/util/cxx11retrocompat.h | 4 ++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/libretroshare/src/file_sharing/p3filelists.cc b/libretroshare/src/file_sharing/p3filelists.cc index 156490e18..7ab77f929 100644 --- a/libretroshare/src/file_sharing/p3filelists.cc +++ b/libretroshare/src/file_sharing/p3filelists.cc @@ -777,10 +777,14 @@ template<> bool p3FileDatabase::convertPointerToEntryIndex<4>(const void *p, Ent { // trust me, I can do this ;-) -#pragma GCC diagnostic ignored "-Wstrict-aliasing" +#if defined(__GNUC__) && !defined(__clang__) +# pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif // defined(__GNUC__) && !defined(__clang__) e = EntryIndex( *reinterpret_cast(&p) & ENTRY_INDEX_BIT_MASK_32BITS ) ; friend_index = (*reinterpret_cast(&p)) >> NB_ENTRY_INDEX_BITS_32BITS ; -#pragma GCC diagnostic pop +#if defined(__GNUC__) && !defined(__clang__) +# pragma GCC diagnostic pop +#endif // defined(__GNUC__) && !defined(__clang__) if(friend_index == 0) { @@ -817,10 +821,14 @@ template<> bool p3FileDatabase::convertPointerToEntryIndex<8>(const void *p, Ent { // trust me, I can do this ;-) +#if defined(__GNUC__) && !defined(__clang__) #pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif // defined(__GNUC__) && !defined(__clang__) e = EntryIndex( *reinterpret_cast(&p) & ENTRY_INDEX_BIT_MASK_64BITS ) ; friend_index = (*reinterpret_cast(&p)) >> NB_ENTRY_INDEX_BITS_64BITS ; +#if defined(__GNUC__) && !defined(__clang__) #pragma GCC diagnostic pop +#endif // defined(__GNUC__) && !defined(__clang__) if(friend_index == 0) { diff --git a/libretroshare/src/util/cxx11retrocompat.h b/libretroshare/src/util/cxx11retrocompat.h index 98dd998db..f210cf87b 100644 --- a/libretroshare/src/util/cxx11retrocompat.h +++ b/libretroshare/src/util/cxx11retrocompat.h @@ -21,7 +21,7 @@ *******************************************************************************/ #pragma once -#ifdef __GNUC__ +#if defined(__GNUC__) && !defined(__clang__) # define GCC_VERSION (__GNUC__*10000+__GNUC_MINOR__*100+__GNUC_PATCHLEVEL__) # if GCC_VERSION < 40700 # define override @@ -30,4 +30,4 @@ # if GCC_VERSION < 40600 # define nullptr NULL # endif // GCC_VERSION < 40600 -#endif //defined GNUC +#endif // defined(__GNUC__) && !defined(__clang__)