--- /dev/null
+/* This token is long enough to require an ad-hoc location. Make sure that
+ the macro trace still prints properly. */
+#define X "0123456789012345678901234567689" /* { dg-error {expected .* before string constant} } */
+X /* { dg-note {in expansion of macro 'X'} } */
location_t l =
linemap_resolve_location (line_table, resolved_def_loc,
LRK_SPELLING_LOCATION, &m);
- if (l < RESERVED_LOCATION_COUNT || LINEMAP_SYSP (m))
+ location_t l0 = l;
+ if (IS_ADHOC_LOC (l0))
+ l0 = get_location_from_adhoc_loc (line_table, l0);
+ if (l0 < RESERVED_LOCATION_COUNT || LINEMAP_SYSP (m))
continue;
/* We need to print the context of the macro definition only
when the locus of the first displayed diagnostic (displayed
before this trace) was inside the definition of the
macro. */
- int resolved_def_loc_line = SOURCE_LINE (m, l);
+ const int resolved_def_loc_line = SOURCE_LINE (m, l0);
if (ix == 0 && saved_location_line != resolved_def_loc_line)
{
diagnostic_append_note (context, resolved_def_loc,