[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] m4: Remove ternary operator from extern-inline
From: |
Martin Kletzander |
Subject: |
[PATCH] m4: Remove ternary operator from extern-inline |
Date: |
Mon, 5 Jun 2017 15:03:19 +0200 |
When compiling libvirt with updated GCC (v7.1.0), the following warning
pops out (which then ends up treated like an error):
../config.h:2994:48: error: this use of "defined" may not be portable
[-Werror=expansion-to-defined]
|| (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \
If I remove the ternary operator, the warning/error goes away.
Signed-off-by: Martin Kletzander <address@hidden>
---
I did not check that the define works the same way on all platforms, I
do not have all of those available. However I did my best when trying
to express the same conditions.
Ideas welcome. If there's another way of approaching it (or someone
else already works on this and I missed it), feel free to tell me
straight away. Thanks.
m4/extern-inline.m4 | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/m4/extern-inline.m4 b/m4/extern-inline.m4
index 00f960968b01..2c418bd4ef8d 100644
--- a/m4/extern-inline.m4
+++ b/m4/extern-inline.m4
@@ -39,16 +39,18 @@ AC_DEFUN([gl_EXTERN_INLINE],
OS X 10.9 has a macro __header_inline indicating the bug is fixed for C and
for clang but remains for g++; see <http://trac.macports.org/ticket/41033>.
Assume DragonFly and FreeBSD will be similar. */
-#if (((defined __APPLE__ && defined __MACH__) \
- || defined __DragonFly__ || defined __FreeBSD__) \
- && (defined __header_inline \
- ? (defined __cplusplus && defined __GNUC_STDC_INLINE__ \
- && ! defined __clang__) \
- : ((! defined _DONT_USE_CTYPE_INLINE_ \
- && (defined __GNUC__ || defined __cplusplus)) \
- || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \
- && defined __GNUC__ && ! defined __cplusplus))))
+# if ((defined __APPLE__ && defined __MACH__) \
+ || defined __DragonFly__ || defined __FreeBSD__)
+# if defined __header_inline
+# if defined __cplusplus && defined __GNUC_STDC_INLINE__ && ! defined
__clang__
+# define _GL_EXTERN_INLINE_STDHEADER_BUG
+# endif
+# elif ((! defined _DONT_USE_CTYPE_INLINE_ \
+ && (defined __GNUC__ || defined __cplusplus)) \
+ || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \
+ && defined __GNUC__ && ! defined __cplusplus))
# define _GL_EXTERN_INLINE_STDHEADER_BUG
+# endif
#endif
#if ((__GNUC__ \
? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \
--
2.13.0
- [PATCH] m4: Remove ternary operator from extern-inline,
Martin Kletzander <=