The weekly CI reports a syntax error:

In file included from ../../gltests/test-stdbit-h-c++.cc:22:
../gllib/stdbit.h:2031:1: error: extraneous closing brace ('}')
 2031 | }
      | ^

The cause is that the block

#ifdef __cplusplus
extern "C" {
#endif

is inside '#if !@HAVE_STDBIT_H@', however the block

#ifdef __cplusplus
}
#endif

is outside.

This patch fixes it.


2026-03-16  Bruno Haible  <[email protected]>

        stdbit-h: Fix syntax error in C++ mode (regression 2026-03-12).
        * lib/stdbit.in.h: Move the 'extern "C" {' outside of the
        '#if !@HAVE_STDBIT_H@'.

diff --git a/lib/stdbit.in.h b/lib/stdbit.in.h
index 981c470564..30e3b0b175 100644
--- a/lib/stdbit.in.h
+++ b/lib/stdbit.in.h
@@ -188,6 +188,11 @@ _GL_INLINE_HEADER_BEGIN
 #endif
 
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
 /* Some systems are only missing C2y features in stdbit.h.  */
 #if !@HAVE_STDBIT_H@
 
@@ -207,10 +212,6 @@ _GL_INLINE_HEADER_BEGIN
 #endif
 
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #if 3 < __GNUC__ + (4 <= __GNUC_MINOR__) || 4 <= __clang_major__
 # define _GL_STDBIT_HAS_BUILTIN_CLZ true
 # define _GL_STDBIT_HAS_BUILTIN_CTZ true
@@ -1171,6 +1172,7 @@ stdc_bit_ceil_ull (unsigned long long int n)
 
 #endif /* @HAVE_STDBIT_H@ */
 
+
 /* ISO C2y § 7.18.17 Rotate Left  */
 
 #if @GNULIB_STDC_ROTATE_LEFT@
@@ -1231,6 +1233,7 @@ stdc_rotate_left_ull (unsigned long long int v, unsigned 
int c)
 
 #endif
 
+
 /* ISO C2y § 7.18.18 Rotate Right  */
 
 #if @GNULIB_STDC_ROTATE_RIGHT@
@@ -1291,6 +1294,7 @@ stdc_rotate_right_ull (unsigned long long int v, unsigned 
int c)
 
 #endif
 
+
 /* ISO C2y § 7.18.19 8-bit Memory Reversal  */
 
 #if @GNULIB_STDC_MEMREVERSE8@




Reply via email to