diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2021-11-18 15:41:45 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2021-11-20 07:36:47 -0500 |
commit | 911438f9f4516f2c5c3fc4eaecc47571aef98d1d (patch) | |
tree | c9411f5939e9ea7ab24baaa576c8ab597c578b91 /gdb/python/python.c | |
parent | 0f8f2de1836941fe0c64ebac47e9a17a9063be86 (diff) | |
download | binutils-911438f9f4516f2c5c3fc4eaecc47571aef98d1d.zip binutils-911438f9f4516f2c5c3fc4eaecc47571aef98d1d.tar.gz binutils-911438f9f4516f2c5c3fc4eaecc47571aef98d1d.tar.bz2 |
gdbsupport: fix array-view compilation with c++11 && _GLIBCXX_DEBUG
When building with -std=c++11 and -D_GLIBCXX_DEBUG=1, we get some errors
like:
CXX unittests/array-view-selftests.o
In file included from /home/smarchi/src/binutils-gdb/gdb/utils.h:25,
from /home/smarchi/src/binutils-gdb/gdb/defs.h:630,
from /home/smarchi/src/binutils-gdb/gdb/unittests/array-view-selftests.c:20:
/home/smarchi/src/binutils-gdb/gdb/../gdbsupport/array-view.h: In instantiation of constexpr gdb::array_view<T> gdb::array_view<T>::slice(gdb::array_view<T>::size_type, gdb::array_view<T>::size_type) const [with T = unsigned char; gdb::array_view<T>::size_type = long unsigned int:
/home/smarchi/src/binutils-gdb/gdb/unittests/array-view-selftests.c:532:29: required from here
/home/smarchi/src/binutils-gdb/gdb/../gdbsupport/array-view.h:192:3: error: body of constexpr function constexpr gdb::array_view<T> gdb::array_view<T>::slice(gdb::array_view<T>::size_type, gdb::array_view<T>::size_type) const [with T = unsigned char; gdb::array_view<T>::size_type = long unsigned int not a return-statement
192 | }
| ^
This is because constexpr functions in c++11 can only consist of a
single return statement, so we can't have the gdb_assert in there. Make
the gdb_assert presence conditional to the __cplusplus version, to
enable it only for c++14 and later.
Change-Id: I2ac33f7b4bd1765ddc3ac8d07445b16ac1f340f0
Diffstat (limited to 'gdb/python/python.c')
0 files changed, 0 insertions, 0 deletions