Bug 1588015 - Provide PR_ASSERT_ARG which avoids unused variable warning. r=mt r=kaie
authorMarcus Burghardt <mburghardt@mozilla.com>
Mon, 28 Oct 2019 10:25:16 +0100
changeset 4846 b8aa9ae7989fe73b8e152b71f2d2cc78d31067c9
parent 4845 65cf6029a830ab5c8648ede6ff49b1c27fb5c9cc
child 4847 918264cc7ff2390eec271e8a3cc9c22bf12658c7
push id344
push userkaie@kuix.de
push dateMon, 28 Oct 2019 09:43:24 +0000
reviewersmt, kaie
bugs1588015
Bug 1588015 - Provide PR_ASSERT_ARG which avoids unused variable warning. r=mt r=kaie
pr/include/prlog.h
--- a/pr/include/prlog.h
+++ b/pr/include/prlog.h
@@ -202,21 +202,25 @@ PR_PRETEND_NORETURN;
 
 #endif /* NO_NSPR_10_SUPPORT */
 
 #if defined(DEBUG) || defined(FORCE_PR_ASSERT)
 
 #define PR_ASSERT(_expr) \
     ((_expr)?((void)0):PR_Assert(# _expr,__FILE__,__LINE__))
 
+#define PR_ASSERT_ARG(_expr) PR_ASSERT(_expr)
+
 #define PR_NOT_REACHED(_reasonStr) \
     PR_Assert(_reasonStr,__FILE__,__LINE__)
 
 #else
 
 #define PR_ASSERT(expr) ((void) 0)
+/* PR_ASSERT_ARG avoids compiler warning: unused variable */
+#define PR_ASSERT_ARG(expr) ((void)(0 && (expr)))
 #define PR_NOT_REACHED(reasonStr)
 
 #endif /* defined(DEBUG) || defined(FORCE_PR_ASSERT) */
 
 PR_END_EXTERN_C
 
 #endif /* prlog_h___ */