From: Bruno Haible Date: Sat, 13 Jul 2024 22:53:57 +0000 (+0200) Subject: stdlib: Support use of clang++ on Ubuntu. X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=a44f2aca0ce2c9755795fc64011490bbd8ae13e2;p=gnulib.git 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. --- diff --git a/ChangeLog b/ChangeLog index 4c4430a300..a97b22aa28 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2024-07-13 Bruno Haible + + 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-13 Bruno Haible doc: Revamp list of dependencies. diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h index cfc69d0a50..47a8856dc7 100644 --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h @@ -20,9 +20,18 @@ #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@