This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make __ASSERT__() empty under Coverity, avoiding many false alerts.
authorJarkko Hietaniemi <jhi@iki.fi>
Tue, 20 Oct 2015 01:11:15 +0000 (21:11 -0400)
committerJarkko Hietaniemi <jhi@iki.fi>
Tue, 20 Oct 2015 02:39:53 +0000 (22:39 -0400)
(As suggested by khw.)

handy.h

diff --git a/handy.h b/handy.h
index ffb8e2f..79e9cfd 100644 (file)
--- a/handy.h
+++ b/handy.h
@@ -280,8 +280,13 @@ typedef U64TYPE U64;
 /* This is a helper macro to avoid preprocessor issues, replaced by nothing
  * unless under DEBUGGING, where it expands to an assert of its argument,
  * followed by a comma (hence the comma operator).  If we just used a straight
- * assert(), we would get a comma with nothing before it when not DEBUGGING */
-#ifdef DEBUGGING
+ * assert(), we would get a comma with nothing before it when not DEBUGGING.
+ *
+ * We also use empty definition under Coverity since the __ASSERT__
+ * checks often check for things that Really Cannot Happen, and Coverity
+ * detects that and gets all excited. */
+
+#if defined(DEBUGGING) && !defined(__COVERITY__)
 #   define __ASSERT_(statement)  assert(statement),
 #else
 #   define __ASSERT_(statement)