]> Savannah Git Hosting - gnulib.git/commitdiff
stdlib: Support use of clang++ on Ubuntu.
authorBruno Haible <bruno@clisp.org>
Sat, 13 Jul 2024 22:53:57 +0000 (00:53 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 21 Jul 2024 01:13:31 +0000 (03:13 +0200)
* lib/stdlib.in.h: Ignore __need_system_stdlib_h when GCC's
c++/11/stdlib.h is being included or has been included.

ChangeLog
lib/stdlib.in.h

index e43d26a02b62befeab1c4f9501a97366c896bb8d..c7af30b4c2849068108852f1d5c7f095baa7e82e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-07-13  Bruno Haible  <bruno@clisp.org>
+
+       stdlib: Support use of clang++ on Ubuntu.
+       * lib/stdlib.in.h: Ignore __need_system_stdlib_h when GCC's
+       c++/11/stdlib.h is being included or has been included.
+
 2024-07-10  Pip Cet  <pipcet@protonmail.com>
 
        timespec-sub: Fix compilation error on clang.
index cfc69d0a50629ef51033c861530b7591997d9100..47a8856dc75fcbb6dcbbf586cff7ee079b04ad7b 100644 (file)
 #endif
 @PRAGMA_COLUMNS@
 
-#if defined __need_system_stdlib_h || defined __need_malloc_and_calloc
+#if (defined __need_system_stdlib_h && !defined _GLIBCXX_STDLIB_H) || defined __need_malloc_and_calloc
 /* Special invocation conventions inside some gnulib header files,
-   and inside some glibc header files, respectively.  */
+   and inside some glibc header files, respectively.
+   Do not recognize this special invocation convention when GCC's
+   c++/11/stdlib.h is being included or has been included. This is needed
+   to support the use of clang+llvm binaries on Ubuntu 22.04 with
+   CXX="$clangdir/bin/clang++ -I/usr/include/c++/11 \
+                              -I/usr/include/x86_64-linux-gnu/c++/11
+                              -L/usr/lib/gcc/x86_64-linux-gnu/11
+                              -Wl,-rpath,$clangdir/lib"
+   because in this case /usr/include/c++/11/stdlib.h (which does not support
+   the convention) is seen before the gnulib-generated stdlib.h.  */
 
 #@INCLUDE_NEXT@ @NEXT_STDLIB_H@