diff options
author | Geert Uytterhoeven <geert@linux-m68k.org> | 2016-09-01 19:14:53 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-09-01 20:52:01 -0400 |
commit | e6173ba42bbdba05fd4f3021c0beda0506271507 (patch) | |
tree | 0b3efdf4ee72f320072389c836b501fbda0c0180 /lib | |
parent | ed76b7a131f41c91b0c725d472f9b969d75ce888 (diff) |
lib/test_hash.c: fix warning in preprocessor symbol evaluation
Some versions of gcc don't like tests for the value of an undefined
preprocessor symbol, even in the #else branch of an #ifndef:
lib/test_hash.c:224:7: warning: "HAVE_ARCH__HASH_32" is not defined [-Wundef]
#elif HAVE_ARCH__HASH_32 != 1
^
lib/test_hash.c:229:7: warning: "HAVE_ARCH_HASH_32" is not defined [-Wundef]
#elif HAVE_ARCH_HASH_32 != 1
^
lib/test_hash.c:234:7: warning: "HAVE_ARCH_HASH_64" is not defined [-Wundef]
#elif HAVE_ARCH_HASH_64 != 1
^
Seen with gcc 4.9, not seen with 4.1.2.
Change the logic to only check the value inside an #ifdef to fix this.
Fixes: 468a9428521e7d00 ("<linux/hash.h>: Add support for architecture-specific functions")
Link: http://lkml.kernel.org/r/20160829214952.1334674-4-arnd@arndb.de
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: George Spelvin <linux@sciencehorizons.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/test_hash.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/lib/test_hash.c b/lib/test_hash.c index 81702ee4c41c..cac20c5fb304 100644 --- a/lib/test_hash.c +++ b/lib/test_hash.c | |||
@@ -219,21 +219,27 @@ test_hash_init(void) | |||
219 | } | 219 | } |
220 | 220 | ||
221 | /* Issue notices about skipped tests. */ | 221 | /* Issue notices about skipped tests. */ |
222 | #ifndef HAVE_ARCH__HASH_32 | 222 | #ifdef HAVE_ARCH__HASH_32 |
223 | pr_info("__hash_32() has no arch implementation to test."); | 223 | #if HAVE_ARCH__HASH_32 != 1 |
224 | #elif HAVE_ARCH__HASH_32 != 1 | ||
225 | pr_info("__hash_32() is arch-specific; not compared to generic."); | 224 | pr_info("__hash_32() is arch-specific; not compared to generic."); |
226 | #endif | 225 | #endif |
227 | #ifndef HAVE_ARCH_HASH_32 | 226 | #else |
228 | pr_info("hash_32() has no arch implementation to test."); | 227 | pr_info("__hash_32() has no arch implementation to test."); |
229 | #elif HAVE_ARCH_HASH_32 != 1 | 228 | #endif |
229 | #ifdef HAVE_ARCH_HASH_32 | ||
230 | #if HAVE_ARCH_HASH_32 != 1 | ||
230 | pr_info("hash_32() is arch-specific; not compared to generic."); | 231 | pr_info("hash_32() is arch-specific; not compared to generic."); |
231 | #endif | 232 | #endif |
232 | #ifndef HAVE_ARCH_HASH_64 | 233 | #else |
233 | pr_info("hash_64() has no arch implementation to test."); | 234 | pr_info("hash_32() has no arch implementation to test."); |
234 | #elif HAVE_ARCH_HASH_64 != 1 | 235 | #endif |
236 | #ifdef HAVE_ARCH_HASH_64 | ||
237 | #if HAVE_ARCH_HASH_64 != 1 | ||
235 | pr_info("hash_64() is arch-specific; not compared to generic."); | 238 | pr_info("hash_64() is arch-specific; not compared to generic."); |
236 | #endif | 239 | #endif |
240 | #else | ||
241 | pr_info("hash_64() has no arch implementation to test."); | ||
242 | #endif | ||
237 | 243 | ||
238 | pr_notice("%u tests passed.", tests); | 244 | pr_notice("%u tests passed.", tests); |
239 | 245 | ||