This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/3] (v2) On-demand locations within string-literals


On Tue, 26 Jul 2016, David Malcolm wrote:

> This patch implements precise tracking of source locations for the
> individual chars within string literals, so that we can e.g. underline
> specific ranges in -Wformat diagnostics.  It handles macros,
> concatenated tokens, escaped characters etc.

What if the string literal results from stringizing other tokens (which 
might have arisen in turn from macro expansion, including expansion of 
built-in macros not just those defined in source files, etc.)?  "You don't 
get precise locations" would be a fine answer for such cases - provided 
there is good testsuite coverage of them to show they don't crash the 
compiler or underline nonsensical characters.

> +	return "range starts after LINE_MAP_MAX_LOCATION_WITH_COLS";

Where do these strings get used?  Hopefully not in diagnostics for users, 
as they aren't written in user terms, and any diagnostic string like that 
would need to be marked up to be extracted for translation.

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]