diff options
Diffstat (limited to 'gcc/input.c')
-rw-r--r-- | gcc/input.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/input.c b/gcc/input.c index 728f4dd65d7..611e18b541e 100644 --- a/gcc/input.c +++ b/gcc/input.c @@ -1322,6 +1322,15 @@ get_substring_ranges_for_loc (cpp_reader *pfile, if (strloc == UNKNOWN_LOCATION) return "unknown location"; + /* Reparsing the strings requires accurate location information. + If -ftrack-macro-expansion has been overridden from its default + of 2, then we might have a location of a macro expansion point, + rather than the location of the literal itself. + Avoid this by requiring that we have full macro expansion tracking + for substring locations to be available. */ + if (cpp_get_options (pfile)->track_macro_expansion != 2) + return "track_macro_expansion != 2"; + /* If string concatenation has occurred at STRLOC, get the locations of all of the literal tokens making up the compound string. Otherwise, just use STRLOC. */ |