From e97c791684c10555654036b7ca48b34cad5f00c7 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 15 Jan 2021 11:18:21 +0100 Subject: [PATCH] Squashed 'shared/c-stdaux/' changes from ffa3dcc36533..346623b40eb8 346623b40eb8 c-stdaux: guard __builtin_choose_expr() from Coverity git-subtree-dir: shared/c-stdaux git-subtree-split: 346623b40eb8137cae7568a69ee42253ff098ff7 --- src/c-stdaux.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/c-stdaux.h b/src/c-stdaux.h index a02aed9c08..6d43027c03 100644 --- a/src/c-stdaux.h +++ b/src/c-stdaux.h @@ -82,7 +82,10 @@ extern "C" { * * Return: Evaluates to @_expr. */ -#define C_EXPR_ASSERT(_expr, _assertion, _message) \ +#if defined(__COVERITY__) // Coverity cannot const-fold __builtin_choose_expr() +# define C_EXPR_ASSERT(_expr, _assertion, _message) (_expr) +#else +# define C_EXPR_ASSERT(_expr, _assertion, _message) \ /* indentation and line-split to get better diagnostics */ \ (__builtin_choose_expr( \ !!(1 + 0 * sizeof( \ @@ -93,6 +96,7 @@ _Static_assert(_assertion, _message); \ (_expr), \ ((void)0) \ )) +#endif /** * C_STRINGIFY() - stringify a token, but evaluate it first