Clarify debug/release decisions triggered by trying to build "Release" mode in xcode -- which either defines or doesn't define DEBUG Diffs= 8d6da9a32 Clarify debug/release for xcode
diff --git a/.rive_head b/.rive_head index dd757ab..59fd6b2 100644 --- a/.rive_head +++ b/.rive_head
@@ -1 +1 @@ -1f9ff75d9c216c4418ab0e282b3501b2592e1e45 +8d6da9a325e1d11d61fa1bede1e5360ff5df95ae
diff --git a/include/rive/rive_types.hpp b/include/rive/rive_types.hpp index 292a64f..9624bb0 100644 --- a/include/rive/rive_types.hpp +++ b/include/rive/rive_types.hpp
@@ -9,41 +9,40 @@ #ifndef _RIVE_TYPES_HPP_ #define _RIVE_TYPES_HPP_ -// We treat NDEBUG is the root of truth from the user. -// Our other symbols (DEBUG, RELEASE) must agree with it. -// ... its ok if our client doesn't set these, we will do that... -// ... they just can't set them inconsistently. +// clang-format off + +#if defined(DEBUG) && defined(NDEBUG) + #error "can't determine if we're debug or release" +#endif + +#if !defined(DEBUG) && !defined(NDEBUG) + // we have to make a decision what mode we're in + // xcode seems to be in Release mode in this case ... + #define NDEBUG 1 +#endif #ifdef NDEBUG -// we're in release mode -#ifdef DEBUG -#error "can't define both DEBUG and NDEBUG" -#endif -#ifndef RELEASE -#define RELEASE -#endif -#else -// we're in debug mode -#ifdef RELEASE -#error "can't define RELEASE and not NDEBUG" -#endif -#ifndef DEBUG -#define DEBUG -#endif + #ifndef RELEASE + #define RELEASE 1 + #endif +#else // debug mode + #ifndef DEBUG + #define DEBUG 1 + #endif #endif // Some checks to guess what platform we're building for #ifdef __APPLE__ -#define RIVE_BUILD_FOR_APPLE -#include <TargetConditionals.h> + #define RIVE_BUILD_FOR_APPLE + #include <TargetConditionals.h> -#if TARGET_OS_IPHONE -#define RIVE_BUILD_FOR_IOS -#elif TARGET_OS_MAC -#define RIVE_BUILD_FOR_OSX -#endif + #if TARGET_OS_IPHONE + #define RIVE_BUILD_FOR_IOS + #elif TARGET_OS_MAC + #define RIVE_BUILD_FOR_OSX + #endif #endif @@ -58,13 +57,13 @@ // Annotations to assert unreachable control flow. #ifdef __GNUC__ // GCC 4.8+, Clang, Intel and others compatible with GCC (-std=c++0x or above) -#define RIVE_UNREACHABLE __builtin_unreachable() + #define RIVE_UNREACHABLE __builtin_unreachable() #elif _MSC_VER -#define RIVE_UNREACHABLE __assume(0) + #define RIVE_UNREACHABLE __assume(0) #else -#define RIVE_UNREACHABLE \ - do { \ - } while (0) + #define RIVE_UNREACHABLE do {} while(0) #endif +// clang-format on + #endif // rive_types