aboutsummaryrefslogtreecommitdiff
path: root/gdbsupport
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2021-11-11 11:22:39 +0100
committerTom de Vries <tdevries@suse.de>2021-11-11 11:22:39 +0100
commitb038b53f1ff4bf00ecdead1db23eddc4fd654305 (patch)
tree3f69df97806d3607f9649b0f05820066dce90cf1 /gdbsupport
parent585d6e39eb4662b4c725e7ed297783529130e598 (diff)
downloadgdb-b038b53f1ff4bf00ecdead1db23eddc4fd654305.zip
gdb-b038b53f1ff4bf00ecdead1db23eddc4fd654305.tar.gz
gdb-b038b53f1ff4bf00ecdead1db23eddc4fd654305.tar.bz2
[gdb/build] Fix build with -std=c++11
When building with -std=c++11, we run into two Werror=missing-declarations: ... new-op.cc: In function 'void operator delete(void*, std::size_t)': new-op.cc:114:1: error: no previous declaration for \ 'void operator delete(void*, std::size_t)' [-Werror=missing-declarations] operator delete (void *p, std::size_t) noexcept ^~~~~~~~ new-op.cc: In function 'void operator delete [](void*, std::size_t)': new-op.cc:132:1: error: no previous declaration for \ 'void operator delete [](void*, std::size_t)' [-Werror=missing-declarations] operator delete[] (void *p, std::size_t) noexcept ^~~~~~~~ ... These are due to recent commit 5fff6115fea "Fix LD_PRELOAD=/usr/lib64/libasan.so.6 gdb". The declarations are provided by <new> (which is included) for c++14 onwards, but they are missing for c++11. Fix this by adding the missing declarations. Tested on x86_64-linux, with gcc 7.5.0, both without (implying -std=gnu++14) and with -std=c++11.
Diffstat (limited to 'gdbsupport')
-rw-r--r--gdbsupport/new-op.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/gdbsupport/new-op.cc b/gdbsupport/new-op.cc
index 2f4c714..716fa1a 100644
--- a/gdbsupport/new-op.cc
+++ b/gdbsupport/new-op.cc
@@ -27,6 +27,11 @@
#include "host-defs.h"
#include <new>
+/* These are declared in <new> starting C++14. Add these here to enable
+ compilation using C++11. */
+extern void operator delete (void *p, std::size_t) noexcept;
+extern void operator delete[] (void *p, std::size_t) noexcept;
+
/* Override operator new / operator new[], in order to internal_error
on allocation failure and thus query the user for abort/core
dump/continue, just like xmalloc does. We don't do this from a