Fix warning caused by clang defining _GNUC_

This commit is contained in:
Gioacchino Mazzurco 2018-10-03 19:04:02 +02:00
parent f26a0c793e
commit e6e5700ed6
No known key found for this signature in database
GPG Key ID: A1FBCA3872E87051
2 changed files with 12 additions and 4 deletions

View File

@ -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<uint32_t*>(&p) & ENTRY_INDEX_BIT_MASK_32BITS ) ;
friend_index = (*reinterpret_cast<uint32_t*>(&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<uint64_t*>(&p) & ENTRY_INDEX_BIT_MASK_64BITS ) ;
friend_index = (*reinterpret_cast<uint64_t*>(&p)) >> NB_ENTRY_INDEX_BITS_64BITS ;
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif // defined(__GNUC__) && !defined(__clang__)
if(friend_index == 0)
{

View File

@ -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__)