[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] branch master updated: do not generate tautological comparisson
From: |
gnunet |
Subject: |
[gnunet] branch master updated: do not generate tautological comparisson warnings for assertions (if gcc/clang version supports them) |
Date: |
Wed, 04 Aug 2021 20:44:54 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new ff5075e7f do not generate tautological comparisson warnings for
assertions (if gcc/clang version supports them)
ff5075e7f is described below
commit ff5075e7f149ffeb9934cb4a505660fc80a9c655
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Wed Aug 4 20:41:25 2021 +0200
do not generate tautological comparisson warnings for assertions (if
gcc/clang version supports them)
---
src/include/gnunet_common.h | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h
index df1ccff26..8cfeab1cc 100644
--- a/src/include/gnunet_common.h
+++ b/src/include/gnunet_common.h
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- Copyright (C) 2006-2020 GNUnet e.V.
+ Copyright (C) 2006-2021 GNUnet e.V.
GNUnet is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published
@@ -875,10 +875,14 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind);
* @ingroup logging
* Use this for fatal errors that cannot be handled
*/
+#if __GNUC__ >= 6 || __clang_major__ >= 6
#define GNUNET_assert(cond) \
do \
{ \
+ _Pragma("GCC diagnostic push") \
+ _Pragma("GCC diagnostic ignored \"-Wtautological-compare\"") \
if (! (cond)) \
+ _Pragma("GCC diagnostic pop") \
{ \
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \
_ ("Assertion failed at %s:%d. Aborting.\n"), \
@@ -887,7 +891,21 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind);
GNUNET_abort_ (); \
} \
} while (0)
-
+#else
+/* older GCC/clangs do not support -Wtautological-compare */
+#define GNUNET_assert(cond) \
+ do \
+ { \
+ if (! (cond)) \
+ { \
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \
+ _ ("Assertion failed at %s:%d. Aborting.\n"), \
+ __FILE__, \
+ __LINE__); \
+ GNUNET_abort_ (); \
+ } \
+ } while (0)
+#endif
/**
* @ingroup logging
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnunet] branch master updated: do not generate tautological comparisson warnings for assertions (if gcc/clang version supports them),
gnunet <=