From cc536b21677586455973f81ee05257ada8efdcb8 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Mon, 2 Oct 2017 10:18:30 +0100 Subject: Fix GDB build with G++ 4.8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit G++ 4.8 trips on: In file included from /opt/gcc-4.8/include/c++/4.8.5/algorithm:62:0, from ../../src/gdb/ada-lang.c:65: /opt/gcc-4.8/include/c++/4.8.5/bits/stl_algo.h: In instantiation of ‘_RandomAccessIterator std::__unguarded_partition(_RandomAccessIterator, _RandomAccessIterator, const _Tp&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Tp = ada_exc_info]’: /opt/gcc-4.8/include/c++/4.8.5/bits/stl_algo.h:2283:70: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >]’ /opt/gcc-4.8/include/c++/4.8.5/bits/stl_algo.h:2315:54: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int]’ /opt/gcc-4.8/include/c++/4.8.5/bits/stl_algo.h:5461:36: required from ‘void std::sort(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator >]’ ../../src/gdb/ada-lang.c:13153:61: required from here /opt/gcc-4.8/include/c++/4.8.5/bits/stl_algo.h:2245:19: error: passing ‘const ada_exc_info’ as ‘this’ argument of ‘bool ada_exc_info::operator<(const ada_exc_info&)’ discards qualifiers [-fpermissive] while (__pivot < *__last) ^ Seems to be a libstdc++ bug meanwhile fixed by: https://gcc.gnu.org/ml/libstdc++/2012-04/msg00074. In any case, there's no reason these methods can't be const. gdb/ChangeLog: 2017-10-02 Tom Tromey Pedro Alves * ada-lang.h (ada_exc_info::operator<): Make const. (ada_exc_info::operator==): Make const. * ada-lang.c (ada_exc_info::operator<, ada_exc_info::operator==): Make const. --- gdb/ada-lang.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gdb/ada-lang.c') diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 7e9f06c..1a0c769 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -13123,7 +13123,7 @@ ada_is_non_standard_exception_sym (struct symbol *sym) by exception address. */ bool -ada_exc_info::operator< (const ada_exc_info &other) +ada_exc_info::operator< (const ada_exc_info &other) const { int result; @@ -13136,7 +13136,7 @@ ada_exc_info::operator< (const ada_exc_info &other) } bool -ada_exc_info::operator== (const ada_exc_info &other) +ada_exc_info::operator== (const ada_exc_info &other) const { return addr == other.addr && strcmp (name, other.name) == 0; } -- cgit v1.1