From: Paul Eggert Date: Sat, 27 Apr 2024 17:31:45 +0000 (-0700) Subject: nullptr: work around GCC 14 nullptr sentinel bug X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=7effd4ba2b98fa1eacada71a0bc24d224a4b6229;p=gnulib.git nullptr: work around GCC 14 nullptr sentinel bug * m4/nullptr.m4 (gl_NULLPTR): Work around GCC bug 114780. --- diff --git a/ChangeLog b/ChangeLog index 5713aa94ef..22fa02383c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2024-04-27 Paul Eggert + + nullptr: work around GCC 14 nullptr sentinel bug + * m4/nullptr.m4 (gl_NULLPTR): Work around GCC bug 114780. + 2024-04-27 Paul Eggert stddef: work around a GCC 14 stddef.h bug diff --git a/m4/nullptr.m4 b/m4/nullptr.m4 index f5721e5c33..ac3788d70b 100644 --- a/m4/nullptr.m4 +++ b/m4/nullptr.m4 @@ -12,7 +12,21 @@ AC_DEFUN([gl_NULLPTR], AC_CACHE_CHECK([for C nullptr], [gl_cv_c_nullptr], [AC_COMPILE_IFELSE( [AC_LANG_SOURCE([[int *p = nullptr;]])], - [gl_cv_c_nullptr=yes], + [gl_cv_c_nullptr=yes + # Work around . + gl_saved_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS -Wall -Werror" + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[void f (char const *, ...) __attribute__ ((sentinel));]], + [[f ("", nullptr);]])], + [], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[void f (char const *, ...) __attribute__ ((sentinel));]], + [[f ("", (void *) 0);]])], + [gl_cv_c_nullptr='not as a sentinel'])]) + CFLAGS=$gl_saved_CFLAGS], [gl_cv_c_nullptr=no])]) gl_c_nullptr=$gl_cv_c_nullptr AC_LANG_POP([C])],