Building a Gnulib testdir with that Intel icx / icpx compiler, I get a
compilation error:
In file included from test-stdbit-h-c++.cc:22:
../gllib/stdbit.h:1309:19: error: unknown type name 'size_t'
1309 | stdc_memreverse8 (size_t n, unsigned char *ptr)
| ^
../gllib/stdbit.h:1318:7: error: use of undeclared identifier 'size_t'; did you
mean 'sizeof'?
1318 | size_t i, j;
| ^~~~~~
| sizeof
../gllib/stdbit.h:1318:14: error: use of undeclared identifier 'i'
1318 | size_t i, j;
| ^
../gllib/stdbit.h:1318:17: error: use of undeclared identifier 'j'
1318 | size_t i, j;
| ^
../gllib/stdbit.h:1319:12: error: use of undeclared identifier 'i'
1319 | for (i = 0, j = n-1; i < j; i++, j--)
| ^
../gllib/stdbit.h:1319:19: error: use of undeclared identifier 'j'
1319 | for (i = 0, j = n-1; i < j; i++, j--)
| ^
../gllib/stdbit.h:1319:28: error: use of undeclared identifier 'i'
1319 | for (i = 0, j = n-1; i < j; i++, j--)
| ^
../gllib/stdbit.h:1319:32: error: use of undeclared identifier 'j'
1319 | for (i = 0, j = n-1; i < j; i++, j--)
| ^
../gllib/stdbit.h:1319:35: error: use of undeclared identifier 'i'
1319 | for (i = 0, j = n-1; i < j; i++, j--)
| ^
../gllib/stdbit.h:1319:40: error: use of undeclared identifier 'j'
1319 | for (i = 0, j = n-1; i < j; i++, j--)
| ^
../gllib/stdbit.h:1321:34: error: use of undeclared identifier 'i'
1321 | unsigned char xi = ptr[i];
| ^
../gllib/stdbit.h:1322:34: error: use of undeclared identifier 'j'
1322 | unsigned char xj = ptr[j];
| ^
../gllib/stdbit.h:1323:15: error: use of undeclared identifier 'j'
1323 | ptr[j] = xi;
| ^
../gllib/stdbit.h:1324:15: error: use of undeclared identifier 'i'
1324 | ptr[i] = xj;
| ^
../gllib/stdbit.h:1341:30: error: unknown type name 'uint_least8_t'
1341 | _GL_STDC_MEMREVERSE8U_INLINE uint_least8_t
| ^
../gllib/stdbit.h:1342:21: error: unknown type name 'uint_least8_t'
1342 | stdc_memreverse8u8 (uint_least8_t value)
| ^
../gllib/stdbit.h:1347:30: error: unknown type name 'uint_least16_t'
1347 | _GL_STDC_MEMREVERSE8U_INLINE uint_least16_t
| ^
../gllib/stdbit.h:1348:22: error: unknown type name 'uint_least16_t'
1348 | stdc_memreverse8u16 (uint_least16_t value)
| ^
../gllib/stdbit.h:1359:30: error: unknown type name 'uint_least32_t'
1359 | _GL_STDC_MEMREVERSE8U_INLINE uint_least32_t
| ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[4]: *** [Makefile:30065: test-stdbit-h-c++.o] Error 1
The cause is that in C++ mode, this compiler's <stdbit.h> does not define
size_t, the types from <stdint.h>, nor the __STDC_ENDIAN_NATIVE__ macro.
This patch fixes it.
2026-04-13 Bruno Haible <[email protected]>
stdbit-h: Port to Intel icpx C++ compiler.
* lib/stdbit.in.h: With the Intel icpx C++ compiler, include <stddef.h>
and <stdint.h>, and define the __STDC_ENDIAN_* macros.
* doc/posix-headers/stdbit.texi: Document the Intel icpx bug.
diff --git a/doc/posix-headers/stdbit.texi b/doc/posix-headers/stdbit.texi
index 2e1556a451..87f91d0a54 100644
--- a/doc/posix-headers/stdbit.texi
+++ b/doc/posix-headers/stdbit.texi
@@ -14,6 +14,9 @@
@item
This header file is missing on many non-C23 platforms:
glibc 2.38, macOS 14, FreeBSD 14.0, NetBSD 10.0, OpenBSD 7.5, AIX 7.3.1, HP-UX
11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
+@item
+This header file does not define the necessary types
+with the Intel @code{icpx} C++ compiler.
@end itemize
Portability problems not fixed by Gnulib:
diff --git a/lib/stdbit.in.h b/lib/stdbit.in.h
index 8b61300041..bcc883b3de 100644
--- a/lib/stdbit.in.h
+++ b/lib/stdbit.in.h
@@ -37,7 +37,7 @@
#error "Please include config.h first."
#endif
-#if !@HAVE_STDBIT_H@
+#if !@HAVE_STDBIT_H@ || (defined __cplusplus && defined __INTEL_CLANG_COMPILER)
/* Get size_t. */
# include <stddef.h>
#endif
@@ -46,7 +46,8 @@
|| (!defined __UINT_FAST64_TYPE__ \
&& (@GNULIB_STDC_MEMREVERSE8U@ \
|| @GNULIB_STDC_LOAD8@ || @GNULIB_STDC_LOAD8_ALIGNED@ \
- || @GNULIB_STDC_STORE8@ || @GNULIB_STDC_STORE8_ALIGNED@)))
+ || @GNULIB_STDC_STORE8@ || @GNULIB_STDC_STORE8_ALIGNED@)) \
+ || (defined __cplusplus && defined __INTEL_CLANG_COMPILER))
/* Get intN_t, uintN_t, int_leastN_t, uint_leastN_t. */
# include <stdint.h>
#endif
@@ -194,7 +195,7 @@ extern "C" {
/* Some systems are only missing C2y features in stdbit.h. */
-#if !@HAVE_STDBIT_H@
+#if !@HAVE_STDBIT_H@ || (defined __cplusplus && defined __INTEL_CLANG_COMPILER)
/* ISO C 23 § 7.18.1 General */
@@ -211,6 +212,11 @@ extern "C" {
# define __STDC_ENDIAN_NATIVE__ __STDC_ENDIAN_LITTLE__
#endif
+#endif
+
+
+/* Some systems are only missing C2y features in stdbit.h. */
+#if !@HAVE_STDBIT_H@
/* ISO C 23 § 7.18.3 Count Leading Zeros */