1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
patch submitted to upstream at https://github.com/cpputest/cpputest/pull/1837
From 2ba7e10e73a1daf7194b83e952df58ce1c985644 Mon Sep 17 00:00:00 2001
From: "Z. Liu" <zhixu.liu@gmail.com>
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 <cstdint>
3. size_t -> std::size_t
Signed-off-by: Z. Liu <zhixu.liu@gmail.com>
---
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 <new>\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 <cstdint>
+#include <new>
+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 <new>\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 <cstdint>
+#include <new>
+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
|