mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 20:33:03 +00:00
fixits: sort them before applying them
An experimental commit introduced a fix-it hint that changes comments such as "/* empty */" into %empty. But in some case, because diagnostics are not necessarily emitted in order, the fixits also come in disorder, which must never happen, as the fixes are installed in one pass. * src/fixits.c (fixits_register): Insert them in order.
This commit is contained in:
@@ -52,6 +52,11 @@ fixit_new (location const *loc, char const* fix)
|
||||
return res;
|
||||
}
|
||||
|
||||
static int
|
||||
fixit_cmp (const fixit *a, const fixit *b)
|
||||
{
|
||||
return location_cmp (a->location, b->location);
|
||||
}
|
||||
|
||||
static void
|
||||
fixit_free (fixit *f)
|
||||
@@ -85,7 +90,7 @@ fixits_register (location const *loc, char const* fix)
|
||||
(gl_listelement_dispose_fn) fixit_free,
|
||||
true);
|
||||
fixit *f = fixit_new (loc, fix);
|
||||
gl_list_add_last (fixits, f);
|
||||
gl_sortedlist_add (fixits, (gl_listelement_compar_fn) fixit_cmp, f);
|
||||
if (feature_flag & feature_fixit_parsable)
|
||||
fixit_print (f, stderr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user