Paul Eggert wrote:
> I attempted to fix these problems by installing the attached patches.

This also produces a compilation error on MSVC:

/cygdrive/d/a/ci-testdir-check/ci-testdir-check/compile cl -nologo -std:c11 
-DHAVE_CONFIG_H -DEXEEXT=\".exe\" -DEXEEXT=\".exe\" -DNO_XMALLOC 
-DEXEEXT=\".exe\" -I. -I../../gllib -I..  -DGNULIB_STRICT_CHECKING=1 
-D_WIN32_WINNT=_WIN32_WINNT_WINXP -I/usr/local/msvc32/include 
-DCONTINUE_AFTER_ASSERT  -MD -c -o hamt.obj `cygpath -w '../../gllib/hamt.c'`
hamt.c
D:\a\ci-testdir-check\ci-testdir-check\testdir-all\gllib\hamt.h(71): fatal 
error C1012: unmatched parenthesis: missing ')'
make[4]: *** [Makefile:12128: hamt.obj] Error 2

MSVC apparently has a problem parsing nested conditional expressions inside #if.
(I had already noticed this some time ago.)

This patch fixes it:


2026-08-12  Bruno Haible  <[email protected]>

        hamt: Fix compilation error on MSVC (regression 2026-08-10).
        * lib/hamt.h (HAVE_C11__ATOMIC): Add parentheses to #if expression.

diff --git a/lib/hamt.h b/lib/hamt.h
index 8430313811..0e4ccc603e 100644
--- a/lib/hamt.h
+++ b/lib/hamt.h
@@ -68,13 +68,14 @@ _GL_INLINE_HEADER_BEGIN
 #ifndef HAVE_C11__ATOMIC
 # if (!defined __STDC_NO_ATOMICS__ && !defined __cplusplus \
       && (defined __apple_build_version__ ? 8000000 <= __apple_build_version__ 
\
-          : defined __clang__ ? 4 <= __clang_major__ \
-          : defined _MSC_VER ? 1935 <= _MSC_VER \
-          : defined __NVCOMPILER \
-          ? 21 < __NVCOMPILER_MAJOR__ + (3 <= __NVCOMPILER_MINOR__) \
-          : defined __GNUC__ ? 4 < __GNUC__ + (9 <= __GNUC_MINOR__) \
-          : (!defined __xlC__ && !defined __PGI \
-             && defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__)))
+          : (defined __clang__ ? 4 <= __clang_major__ \
+             : (defined _MSC_VER ? 1935 <= _MSC_VER \
+                : (defined __NVCOMPILER \
+                   ? 21 < __NVCOMPILER_MAJOR__ + (3 <= __NVCOMPILER_MINOR__) \
+                   : (defined __GNUC__ ? 4 < __GNUC__ + (9 <= __GNUC_MINOR__) \
+                      : (!defined __xlC__ && !defined __PGI \
+                         && defined __STDC_VERSION__ \
+                         && 201112 <= __STDC_VERSION__)))))))
 #  define HAVE_C11__ATOMIC 1
 # else
 #  define HAVE_C11__ATOMIC 0




          • Re: in... Bruno Haible via Gnulib discussion list
            • R... Paul Eggert
            • R... Arsen Arsenović
            • R... Bruno Haible via Gnulib discussion list
            • R... Arsen Arsenović
            • G... Paul Eggert
            • R... Marc Nieper-Wißkirchen via Gnulib discussion list
            • R... Bruno Haible via Gnulib discussion list
            • R... Paul Eggert
            • R... Bruno Haible via Gnulib discussion list
            • R... Bruno Haible via Gnulib discussion list
            • R... Bruno Haible via Gnulib discussion list
            • R... Arsen Arsenović
            • R... Paul Eggert
            • R... Bruno Haible via Gnulib discussion list
  • Re: incorrect use of 'p... Bruno Haible via Gnulib discussion list

Reply via email to