patch submitted to upstream at https://github.com/cpputest/cpputest/pull/1837 From 2ba7e10e73a1daf7194b83e952df58ce1c985644 Mon Sep 17 00:00:00 2001 From: "Z. Liu" Date: Sun, 12 Jan 2025 23:04:59 +0800 Subject: [PATCH] configure.ac: fix call of AC_LANG_PROGRAM & unexpected compilation errors 1. multiple line should be enclosed by [[ ]], otherwise compilation of conftest.cpp will failed with: error: extra tokens at end of #include directive [-Werror,-Wextra-tokens] 2. add #include 3. size_t -> std::size_t Signed-off-by: Z. Liu --- configure.ac | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index b19c9eb6..e91c4a27 100644 --- a/configure.ac +++ b/configure.ac @@ -325,13 +325,17 @@ AC_LANG_PUSH([C++]) # Can we use operator delete without exception handling specifier? (clang warns on this!) CXXFLAGS="-Werror" AC_MSG_CHECKING([whether CXX supports operator delete without exception handling specifier]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include \nvoid operator delete(void* mem);])], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]); UT_DELETE_MUST_HAVE_EXCEPTION_SPECIFIER="yes"]) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include +#include +void operator delete(void* mem);]])], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]); UT_DELETE_MUST_HAVE_EXCEPTION_SPECIFIER="yes"]) CXXFLAGS="$saved_cxxflags" # Can we use operator new with exception specifier (g++4.7 on MacOSX is broken here) CXXFLAGS="-Werror" AC_MSG_CHECKING([whether CXX supports operator new with exception handling specifier]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include \nvoid* operator new(size_t size) throw(std::bad_alloc);;])], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]); UT_NEW_CANT_HAVE_EXCEPTION_SPECIFIER="yes"]) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include +#include +void* operator new(std::size_t size) throw(std::bad_alloc);;]])], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]); UT_NEW_CANT_HAVE_EXCEPTION_SPECIFIER="yes"]) CXXFLAGS="$saved_cxxflags" # Flag -Wno-missing-exception-spec -- 2.45.2