This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Fix build failure in linux-osdata.c


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=824dfcc311958af08c25d29956da2bab99e240c9

commit 824dfcc311958af08c25d29956da2bab99e240c9
Author: Simon Marchi <simon.marchi@ericsson.com>
Date:   Sat Oct 14 09:28:07 2017 -0400

    Fix build failure in linux-osdata.c
    
    Commit
    
      Use std::vector in linux_xfer_osdata_processgroups
      b129dcac882da87767cb863ad8b2572f90e9e5bc
    
    broke the build with older gcc (at least 4.7 and 4.8):
    
    In file included from /usr/include/c++/4.7/algorithm:63:0,
                     from /home/emaisin/src/binutils-gdb/gdb/nat/linux-osdata.c:40:
    /usr/include/c++/4.7/bits/stl_algo.h: In instantiation of â??_RandomAccessIterator std::__unguarded_partition(_RandomAccessIterator, _RandomAccessIterator, const _Tp&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<pid_pgid_entry*, std::vector<pid_pgid_entry> >; _Tp = pid_pgid_entry]â??:
    /usr/include/c++/4.7/bits/stl_algo.h:2315:70:   required from â??_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<pid_pgid_entry*, std::vector<pid_pgid_entry> >]â??
    /usr/include/c++/4.7/bits/stl_algo.h:2347:54:   required from â??void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<pid_pgid_entry*, std::vector<pid_pgid_entry> >; _Size = long int]â??
    /usr/include/c++/4.7/bits/stl_algo.h:5483:4:   required from â??void std::sort(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<pid_pgid_entry*, std::vector<pid_pgid_entry> >]â??
    /home/emaisin/src/binutils-gdb/gdb/nat/linux-osdata.c:480:57:   required from here
    /usr/include/c++/4.7/bits/stl_algo.h:2277:4: error: passing â??const pid_pgid_entryâ?? as â??thisâ?? argument of â??bool pid_pgid_entry::operator<(const pid_pgid_entry&)â?? discards qualifiers [-fpermissive]
    
    Making the operator< method const fixes it.
    
    gdb/ChangeLog:
    
    	* nat/linux-osdata.c (struct pid_pgid_entry) <operator<>: Make
    	const.

Diff:
---
 gdb/ChangeLog          | 5 +++++
 gdb/nat/linux-osdata.c | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index af22deb..25ae470 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2017-10-14  Simon Marchi  <simon.marchi@ericsson.com>
+
+	* nat/linux-osdata.c (struct pid_pgid_entry) <operator<>: Make
+	const.
+
 2017-10-14  Simon Marchi  <simon.marchi@polymtl.ca>
 
 	* target.h: Include tracepoint.h.
diff --git a/gdb/nat/linux-osdata.c b/gdb/nat/linux-osdata.c
index 5d1a7bd..0980c8d 100644
--- a/gdb/nat/linux-osdata.c
+++ b/gdb/nat/linux-osdata.c
@@ -407,7 +407,7 @@ struct pid_pgid_entry
     return pid == pgid;
   }
 
-  bool operator< (const pid_pgid_entry &other)
+  bool operator< (const pid_pgid_entry &other) const
   {
     /* Sort by PGID.  */
     if (this->pgid != other.pgid)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]