Re: [PATCH 2/2, libcpp] Fix lookup of macro maps

2011-10-24 Thread Jason Merrill
OK. Jason

Re: [PATCH 2/2, libcpp] Fix lookup of macro maps

2011-10-24 Thread Dodji Seketeli
Jason Merrill writes: > I think a better fix to your binary search algorithm would be to change > > mn = md; > > to be > > mn = md + 1; > > since you've eliminated md as a possibility. And then change the test to > > (mn < mx). > Right, thanks. Here the updated patch, bootstrapped and te

Re: [PATCH 2/2, libcpp] Fix lookup of macro maps

2011-10-22 Thread Jason Merrill
On 10/21/2011 07:53 PM, Dodji Seketeli wrote: - do + while (mx - mn> 1) { md = (mx + mn) / 2; if (MAP_START_LOCATION (LINEMAPS_MACRO_MAP_AT (set, md))> line) mn = md; else mx = md; -} while (mx - mn> 1); +} + + /* There are cases where m

Re: [PATCH 2/2, libcpp] Fix lookup of macro maps

2011-10-21 Thread Dodji Seketeli
This is the right patch that I bootstrapped and tested. * line-map.c (linemap_macro_map_lookup): Make sure to always pick the map with the highest MAP_START_LOCATION. --- libcpp/line-map.c |9 +++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/libcpp/line

[PATCH 2/2, libcpp] Fix lookup of macro maps

2011-10-21 Thread Dodji Seketeli
Hello, I noticed that linemap_macro_map_lookup can yield the wrong map when at the end of the lookup, we end up with a pair of maps whose indexes are (mn,mx) with mx-mn == 1. In that case, if the map we want is mn, we'd wrongly yield mx. Fixed thus, bootstrapped and tested on x86_64-unknown-linu