]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: xxhash: silence a build warning on Solaris + gcc-5.5
authorWilly Tarreau <w@1wt.eu>
Wed, 17 Apr 2024 07:41:30 +0000 (09:41 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 17 Apr 2024 07:43:32 +0000 (09:43 +0200)
Testing an undefined macro emits warnings due to -Wundef, and we have
exactly one such case in xxhash:

  include/import/xxhash.h:3390:42: warning: "__cplusplus" is not defined [-Wundef]
   #if ((defined(sun) || defined(__sun)) && __cplusplus) /* Solaris includes __STDC_VERSION__ with C++. Tested with GCC 5.5 */

Let's just prepend "defined(__cplusplus) &&" before __cplusplus to
resolve the problem. Upstream is still affected apparently.

include/import/xxhash.h

index a18e8c762daaaaa0db8974232a876315ed6ca6f2..7c3c3fcbabbb05341b525558a8773090a2813d36 100644 (file)
@@ -3387,7 +3387,7 @@ XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(XXH_NOESCAPE const XXH64_can
 
 /* ===   Compiler specifics   === */
 
-#if ((defined(sun) || defined(__sun)) && __cplusplus) /* Solaris includes __STDC_VERSION__ with C++. Tested with GCC 5.5 */
+#if ((defined(sun) || defined(__sun)) && defined(__cplusplus) && __cplusplus) /* Solaris includes __STDC_VERSION__ with C++. Tested with GCC 5.5 */
 #  define XXH_RESTRICT   /* disable */
 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L   /* >= C99 */
 #  define XXH_RESTRICT   restrict