[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
improve clang support (14)
From: |
Bruno Haible |
Subject: |
improve clang support (14) |
Date: |
Sun, 09 Aug 2020 15:08:01 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-186-generic; KDE/5.18.0; x86_64; ; ) |
clang does not need the workaround in ignore-value.h: A simple cast to void
silences the __warn_unused_result warnings with clang.
2020-08-09 Bruno Haible <bruno@clisp.org>
ignore-value: Simplify on clang.
* lib/ignore-value.h (ignore_value): With clang, no need to use the GCC
workaround.
diff --git a/lib/ignore-value.h b/lib/ignore-value.h
index 7a92226..ec3288f 100644
--- a/lib/ignore-value.h
+++ b/lib/ignore-value.h
@@ -39,8 +39,9 @@
versions 3.4 and newer have __attribute__ ((__warn_unused_result__))
which may cause unwanted diagnostics in that case. Use __typeof__
and __extension__ to work around the problem, if the workaround is
- known to be needed. */
-#if 3 < __GNUC__ + (4 <= __GNUC_MINOR__)
+ known to be needed.
+ The workaround is not needed with clang. */
+#if (3 < __GNUC__ + (4 <= __GNUC_MINOR__)) && !defined __clang__
# define ignore_value(x) \
(__extension__ ({ __typeof__ (x) __x = (x); (void) __x; }))
#else
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- improve clang support (14),
Bruno Haible <=