Skip to content

Commit

Permalink
IGL: Make sure IGL_VERIFY is nodiscard in non-debug builds
Browse files Browse the repository at this point in the history
Reviewed By: ChristianK275, rameshviswanathan

Differential Revision: D66757082

fbshipit-source-id: c7afcde266e883a119bbe93d59afbe1b982b1f9a
  • Loading branch information
Eric Griffith authored and facebook-github-bot committed Dec 7, 2024
1 parent d369a38 commit fe2dbec
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/igl/Assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ namespace igl {
bool isDebugBreakEnabled();
void setDebugBreakEnabled(bool enabled);

[[nodiscard]] inline bool _IGLAlwaysTrue() {
return true;
[[nodiscard]] inline bool _IGLEnsureNoDiscard(bool cond) {
return cond;
}

inline void _IGLDebugAbortV([[maybe_unused]] const char* category,
Expand Down Expand Up @@ -134,7 +134,7 @@ inline void _IGLDebugAbortV([[maybe_unused]] const char* category,

#define _IGL_DEBUG_ABORT_IMPL(cond, reason, format, ...) \
(cond \
? ::igl::_IGLAlwaysTrue() \
? ::igl::_IGLEnsureNoDiscard(true) \
: ::igl::_IGLDebugAbort( \
IGL_ERROR_CATEGORY, reason, IGL_FUNCTION, __FILE__, __LINE__, format, ##__VA_ARGS__))

Expand All @@ -152,8 +152,8 @@ inline void _IGLDebugAbortV([[maybe_unused]] const char* category,

#define _IGL_DEBUG_ABORT(format, ...) static_cast<void>(0)
#define _IGL_DEBUG_ASSERT(cond, format, ...) static_cast<void>(0)
#define _IGL_DEBUG_VERIFY(cond, format, ...) (cond)
#define _IGL_DEBUG_VERIFY_NOT(cond, format, ...) (cond)
#define _IGL_DEBUG_VERIFY(cond, format, ...) ::igl::_IGLEnsureNoDiscard(!!(cond))
#define _IGL_DEBUG_VERIFY_NOT(cond, format, ...) ::igl::_IGLEnsureNoDiscard(!!(cond))

#endif // IGL_VERIFY_ENABLED

Expand Down Expand Up @@ -232,7 +232,7 @@ namespace igl {

#define _IGL_SOFT_ERROR_IMPL(cond, reason, format, ...) \
(cond \
? ::igl::_IGLAlwaysTrue() \
? ::igl::_IGLEnsureNoDiscard(true) \
: ::igl::_IGLSoftError( \
IGL_ERROR_CATEGORY, reason, IGL_FUNCTION, __FILE__, __LINE__, format, ##__VA_ARGS__))

Expand All @@ -250,8 +250,8 @@ namespace igl {

#define _IGL_SOFT_ERROR(format, ...) static_cast<void>(0)
#define _IGL_SOFT_ASSERT(cond, format, ...) static_cast<void>(0)
#define _IGL_SOFT_VERIFY(cond, format, ...) (cond)
#define _IGL_SOFT_VERIFY_NOT(cond, format, ...) (cond)
#define _IGL_SOFT_VERIFY(cond, format, ...) ::igl::_IGLEnsureNoDiscard(!!(cond))
#define _IGL_SOFT_VERIFY_NOT(cond, format, ...) ::igl::_IGLEnsureNoDiscard(!!(cond))

#endif // IGL_SOFT_ERROR_ENABLED

Expand Down

0 comments on commit fe2dbec

Please sign in to comment.