summaryrefslogtreecommitdiff
path: root/gcc/gcov-io.h
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/gcov-io.h')
-rw-r--r--gcc/gcov-io.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/gcov-io.h b/gcc/gcov-io.h
index 50eacccdc46..eaa23adcb47 100644
--- a/gcc/gcov-io.h
+++ b/gcc/gcov-io.h
@@ -547,10 +547,15 @@ GCOV_LINKAGE time_t gcov_time (void);
#endif
/* Make sure the library is used correctly. */
+#if IN_LIBGCOV
#if ENABLE_CHECKING
-#define GCOV_CHECK(expr) ((expr) ? (void)0 : (void)abort ())
+#define GCOV_CHECK(EXPR) (!(EXPR) ? abort (), 0 : 0)
+#else
+/* Include EXPR, so that unused variable warnings do not occur. */
+#define GCOV_CHECK(EXPR) ((void)(0 && (EXPR)))
+#endif
#else
-#define GCOV_CHECK(expr)
+#define GCOV_CHECK(EXPR) gcc_assert (EXPR)
#endif
#define GCOV_CHECK_READING() GCOV_CHECK(gcov_var.mode > 0)
#define GCOV_CHECK_WRITING() GCOV_CHECK(gcov_var.mode < 0)