From 93ea52c23ae60af458cde5a31cc00b873d18bec2 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sun, 15 Feb 2015 13:55:45 +0100 Subject: [PATCH 1/2] Compile fixes for Apple GCC 4.2 --- 3rdparty/ib-compress/readbitstream.h | 7 ++++++- examples/common/font/font_manager.cpp | 4 ++++ examples/common/nanovg/fontstash.h | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/3rdparty/ib-compress/readbitstream.h b/3rdparty/ib-compress/readbitstream.h index 73280fd9..4dfc4f92 100644 --- a/3rdparty/ib-compress/readbitstream.h +++ b/3rdparty/ib-compress/readbitstream.h @@ -95,11 +95,16 @@ inline ReadBitstream::ReadBitstream( const uint8_t* buffer, size_t bufferSize ) } } +#if defined(__GNUC__) || defined(_MSC_VER) +#define U64(val) val##ULL +#else +#define U64(val) val +#endif RBS_INLINE uint32_t ReadBitstream::Read( uint32_t bitCount ) { uint64_t mask = ( uint64_t( 1 ) << bitCount ) - 1; - uint32_t result = static_cast< uint32_t >( ( m_bitBuffer >> ( 64 - m_bitsLeft ) & ( m_bitsLeft == 0 ? 0 : 0xFFFFFFFFFFFFFFFF ) ) & mask ); + uint32_t result = static_cast< uint32_t >( ( m_bitBuffer >> ( 64 - m_bitsLeft ) & ( m_bitsLeft == 0 ? 0 : U64(0xFFFFFFFFFFFFFFFF) ) ) & mask ); if ( m_bitsLeft < bitCount ) { diff --git a/examples/common/font/font_manager.cpp b/examples/common/font/font_manager.cpp index 6161b296..9717f5d4 100644 --- a/examples/common/font/font_manager.cpp +++ b/examples/common/font/font_manager.cpp @@ -13,10 +13,14 @@ BX_PRAGMA_DIAGNOSTIC_PUSH(); BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4245) // error C4245: '=' : conversion from 'int' to 'FT_UInt', signed/unsigned mismatch +#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) #pragma push_macro("interface") +#endif #undef interface #include +#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) #pragma pop_macro("interface") +#endif BX_PRAGMA_DIAGNOSTIC_POP(); #include "../common.h" diff --git a/examples/common/nanovg/fontstash.h b/examples/common/nanovg/fontstash.h index 5f4dd3f6..411b1a87 100644 --- a/examples/common/nanovg/fontstash.h +++ b/examples/common/nanovg/fontstash.h @@ -428,6 +428,7 @@ struct FONScontext void* errorUptr; }; +#if 0 static void* fons__tmpalloc(size_t size, void* up) { unsigned char* ptr; @@ -453,6 +454,7 @@ static void fons__tmpfree(void* ptr, void* up) // empty } +#endif // Copyright (c) 2008-2010 Bjoern Hoehrmann // See http://bjoern.hoehrmann.de/utf-8/decoder/dfa/ for details. From 88998f7cd841ad687adaef260e2547a7551f9fdb Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sun, 15 Feb 2015 18:59:47 +0100 Subject: [PATCH 2/2] Compile fixes for Apple GCC 4.2 --- 3rdparty/ib-compress/readbitstream.h | 8 +------- examples/common/font/font_manager.cpp | 4 ++-- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/3rdparty/ib-compress/readbitstream.h b/3rdparty/ib-compress/readbitstream.h index 4dfc4f92..1e2f0f33 100644 --- a/3rdparty/ib-compress/readbitstream.h +++ b/3rdparty/ib-compress/readbitstream.h @@ -95,16 +95,10 @@ inline ReadBitstream::ReadBitstream( const uint8_t* buffer, size_t bufferSize ) } } -#if defined(__GNUC__) || defined(_MSC_VER) -#define U64(val) val##ULL -#else -#define U64(val) val -#endif - RBS_INLINE uint32_t ReadBitstream::Read( uint32_t bitCount ) { uint64_t mask = ( uint64_t( 1 ) << bitCount ) - 1; - uint32_t result = static_cast< uint32_t >( ( m_bitBuffer >> ( 64 - m_bitsLeft ) & ( m_bitsLeft == 0 ? 0 : U64(0xFFFFFFFFFFFFFFFF) ) ) & mask ); + uint32_t result = static_cast< uint32_t >( ( m_bitBuffer >> ( 64 - m_bitsLeft ) & ( m_bitsLeft == 0 ? 0 : UINT64_C(0xFFFFFFFFFFFFFFFF) ) ) & mask ); if ( m_bitsLeft < bitCount ) { diff --git a/examples/common/font/font_manager.cpp b/examples/common/font/font_manager.cpp index 9717f5d4..8532a534 100644 --- a/examples/common/font/font_manager.cpp +++ b/examples/common/font/font_manager.cpp @@ -13,12 +13,12 @@ BX_PRAGMA_DIAGNOSTIC_PUSH(); BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4245) // error C4245: '=' : conversion from 'int' to 'FT_UInt', signed/unsigned mismatch -#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) +#if BX_COMPILER_MSVC || BX_COMPILER_GCC >= 40300 #pragma push_macro("interface") #endif #undef interface #include -#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) +#if BX_COMPILER_MSVC || BX_COMPILER_GCC >= 40300 #pragma pop_macro("interface") #endif BX_PRAGMA_DIAGNOSTIC_POP();