On 5/20/20 2:22 PM, Nathan Sidwell wrote:
Here are some small cleanups.
The one bug fix is try_to_locate_new_include_insertion_point was using
pointer comparison to compare strings. This usually works, because the
line table doesn't duplicate file names. Except when reading
preprocessed input. In that case this was failing horribly. I do not
add a pointer comparison on the, possibly rash, assumption strcmp does
that already.
I'm reverting that change. It is not ready. The first map has a
different string for the main file name, and we were relying on that not
equalling the later ones via pointer comparison.
I must have become confused over what tree I was testing. Sorry about that.
nathan
--
Nathan Sidwell
2020-05-20 Nathan Sidwell <nat...@acm.org>
* c-common.c (try_to_locate_new_include_insertion_point): Revert change.
diff --git i/gcc/c-family/c-common.c w/gcc/c-family/c-common.c
index 10c0353fe4e..b1379faa412 100644
--- i/gcc/c-family/c-common.c
+++ w/gcc/c-family/c-common.c
@@ -8708,8 +8708,7 @@ try_to_locate_new_include_insertion_point (const char *file, location_t loc)
last_ord_map_after_include = NULL;
}
- if (0 == strcmp (ord_map->to_file, file)
- && ord_map->to_line)
+ if (ord_map->to_file == file)
{
if (!first_ord_map_in_file)
first_ord_map_in_file = ord_map;