[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] build: avoid spurious test.c warning with -Wsuggest-attribute=pu
From: |
Jim Meyering |
Subject: |
[PATCH] build: avoid spurious test.c warning with -Wsuggest-attribute=pure |
Date: |
Fri, 30 Dec 2011 22:50:38 +0100 |
Without this, building on rawhide has been failing for some time
when configured with --enable-gcc-warnings. The warning/error is
unwarranted, since the function may exit.
>From 9be9d120f01fa65be33ab98d0c728a7e849c5d4b Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Fri, 30 Dec 2011 22:48:38 +0100
Subject: [PATCH] build: avoid spurious test.c warning with
-Wsuggest-attribute=pure
* src/test.c: Add pragma to suppress gcc-4.6.2's warning that
"advance" might be candidate for attribute 'pure'.
---
src/test.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/test.c b/src/test.c
index a5df7c8..00f97fb 100644
--- a/src/test.c
+++ b/src/test.c
@@ -20,6 +20,12 @@
/* Define TEST_STANDALONE to get the /bin/test version. Otherwise, you get
the shell builtin version. */
+/* Without this pragma, gcc 4.6.2 20111027 mistakenly suggests that
+ the advance function might be candidate for attribute 'pure'. */
+#if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNUC__
+# pragma GCC diagnostic ignored "-Wsuggest-attribute=pure"
+#endif
+
#include <config.h>
#include <stdio.h>
#include <sys/types.h>
--
1.7.8.1.391.g2c2ad
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] build: avoid spurious test.c warning with -Wsuggest-attribute=pure,
Jim Meyering <=