+2010-08-18 Roland McGrath <roland@redhat.com>
+
+ * c++/subr.hh (subr::container_tail_equal): New function.
+ * c++/dwarf_data (dwarf_data::directory_table::operator==): Use it
+ to ignore the compilation directory (first table element).
+
2010-07-21 Roland McGrath <roland@redhat.com>
* c++/dwarf_ref_maker (dwarf_ref_maker::seen): Add copy constructor
/* elfutils::dwarf_data -- internal DWARF data representations in -*- C++ -*-
- Copyright (C) 2009 Red Hat, Inc.
+ Copyright (C) 2009-2010 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
template<typename table>
inline bool operator== (const table &other) const
{
- return size () == other.size () && subr::container_equal (*this, other);
+ /* We ignore the first element, the compilation directory.
+ This is actually part of the CU, not part of the line info.
+ The directory table itself matches regardless. */
+ return (size () == other.size ()
+ && subr::container_tail_equal (*this, other, 1));
}
template<typename table>
inline bool operator!= (const table &other) const
}
template<typename t1, typename t2, typename pred_type>
- inline bool container_equal (const t1 &a, const t2 &b, pred_type pred)
+ inline bool container_equal (const t1 &a, const t2 &b, pred_type pred,
+ typename t1::size_type skip = 0)
{
typename t1::const_iterator first1 = a.begin ();
typename t1::const_iterator last1 = a.end ();
typename t2::const_iterator first2 = b.begin ();
typename t2::const_iterator last2 = b.end ();
+ while (skip-- > 0)
+ {
+ if (first1 == last1)
+ return first2 == last2;
+ if (first2 == last2)
+ return first1 == last1;
+ ++first1;
+ ++first2;
+ }
return container_equal (first1, last1, first2, last2, pred);
}
return container_equal (a, b, deref_equal_to<t1, t2> ());
}
+ template<typename t1, typename t2>
+ inline bool container_tail_equal (const t1 &a, const t2 &b,
+ typename t1::size_type skip = 0)
+ {
+ return container_equal (a, b, deref_equal_to<t1, t2> (), skip);
+ }
+
template<typename iter>
inline typename iter::difference_type length (iter i, const iter &end)
{