You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by GitBox <gi...@apache.org> on 2021/02/18 22:15:26 UTC
[GitHub] [trafficserver] SolidWallOfCode commented on a change in pull request #7532: Fix asserts in multiplexer plugin.
SolidWallOfCode commented on a change in pull request #7532:
URL: https://github.com/apache/trafficserver/pull/7532#discussion_r578782470
##########
File path: plugins/multiplexer/dispatch.h
##########
@@ -31,12 +31,32 @@
#include "ts.h"
-#define CHECK(X) \
- { \
- const TSReturnCode r = static_cast<TSReturnCode>(X); \
- assert(r == TS_SUCCESS); \
+#ifdef __OPTIMIZE__
+
+// Optimized -- release build.
+
+// For CHECK(), execute any side effects (only) for expression X.
+#define CHECK(X) \
+ { \
+ static_cast<void>(X); \
}
+// Make sure assert() disabled.
+#ifndef NDEBUG
+#define NDEBUG
+#endif
+
+#else
+
+// Check if expression X returns a value that implicitly converts to bool false (such as TS_SUCCESS).
+#define CHECK(X) \
+ { \
+ assert(!TS_SUCCESS); \
Review comment:
Should `static_assert` here.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org