Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1408643

Re: [PATCH 2/2] test/hash: Fix warning in preprocessor symbol evaluation

From "George Spelvin" <linux@sciencehorizons.net>
Newsgroups linux.kernel
Subject Re: [PATCH 2/2] test/hash: Fix warning in preprocessor symbol evaluation
Date 2016-05-29 21:00 +0200
Message-ID <rEe6m-1x2-9@gated-at.bofh.it> (permalink)
References <rEd0C-Ss-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> Some versions of gcc don't like tests for the value of an undefined
> preprocessor symbol, even in the #else branch of an #ifndef:

Damn, I had hoped that would work universally; I tried to avoid the
uglier #if-inside-#ifdef construction.  GCC 6 is quite happy wth it.

But no objections.

If you want:
Acked-by: George Spelvin <linux@sciencehorizons.net>

But here's an alternative.  Geert, what do you think of this?

diff --git a/lib/test_hash.c b/lib/test_hash.c
index c9549c8b..8ea1d2ca 100644
--- a/lib/test_hash.c
+++ b/lib/test_hash.c
@@ -221,17 +221,17 @@ test_hash_init(void)
 	/* Issue notices about skipped tests. */
 #ifndef HAVE_ARCH__HASH_32
 	pr_info("__hash_32() has no arch implementation to test.");
-#elif HAVE_ARCH__HASH_32 != 1
+#elif HAVE_ARCH__HASH_32 + 0 != 1
 	pr_info("__hash_32() is arch-specific; not compared to generic.");
 #endif
 #ifndef HAVE_ARCH_HASH_32
 	pr_info("hash_32() has no arch implementation to test.");
-#elif HAVE_ARCH_HASH_32 != 1
+#elif HAVE_ARCH_HASH_32  + 0 != 1
 	pr_info("hash_32() is arch-specific; not compared to generic.");
 #endif
 #ifndef HAVE_ARCH_HASH_64
 	pr_info("hash_64() has no arch implementation to test.");
-#elif HAVE_ARCH_HASH_64 != 1
+#elif HAVE_ARCH_HASH_64 + 0 != 1
 	pr_info("hash_64() is arch-specific; not compared to generic.");
 #endif
 

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] test/hash: Fix warning in two-dimensional array init Geert Uytterhoeven <geert@linux-m68k.org> - 2016-05-29 19:50 +0200
  [PATCH 2/2] test/hash: Fix warning in preprocessor symbol evaluation Geert Uytterhoeven <geert@linux-m68k.org> - 2016-05-29 19:50 +0200
    Re: [PATCH 2/2] test/hash: Fix warning in preprocessor symbol evaluation "George Spelvin" <linux@sciencehorizons.net> - 2016-05-29 21:00 +0200
      Re: [PATCH 2/2] test/hash: Fix warning in preprocessor symbol evaluation "George Spelvin" <linux@sciencehorizons.net> - 2016-05-29 21:10 +0200
  Re: [PATCH 1/2] test/hash: Fix warning in two-dimensional array init "George Spelvin" <linux@sciencehorizons.net> - 2016-05-29 20:50 +0200

csiph-web