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

2016-08-04 Thread Jeff Law
On 08/04/2016 08:27 AM, David Malcolm wrote: As for test coverage, v2 and v3 of the kit add over a thousand lines of selftest code that heavily exercise string lexing, using the line_table_case machinery to run the tests with various interesting boundary conditions with line_table (e.g. near

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

2016-08-04 Thread David Malcolm
On Wed, 2016-08-03 at 09:59 -0600, Jeff Law wrote: > On 07/29/2016 03:42 PM, Joseph Myers wrote: > > 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. > >

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

2016-08-03 Thread Jeff Law
On 07/29/2016 03:42 PM, Joseph Myers wrote: 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,

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

2016-08-03 Thread Jeff Law
On 07/29/2016 11:27 AM, David Malcolm wrote: On Fri, 2016-07-29 at 17:53 +0100, Manuel López-Ibáñez wrote: On 29 July 2016 at 16:25, David Malcolm wrote: FWIW, it appears that clang uses the on-demand approach; the relevant code appears to be

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

2016-08-01 Thread Joseph Myers
On Thu, 28 Jul 2016, Martin Sebor wrote: > like it as well. So perhaps the problem to solve is how to teach > LTO to talk to the front end. One way to do it would be to build > the front ends as shared libraries. I think building front ends as shared libraries would run into different

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

2016-07-29 Thread Manuel López-Ibáñez
On 29 July 2016 at 18:27, David Malcolm wrote: > On Fri, 2016-07-29 at 17:53 +0100, Manuel López-Ibáñez wrote: >> On 29 July 2016 at 16:25, David Malcolm wrote: >> > >> > FWIW, it appears that clang uses the on-demand approach; the >> > relevant >> >

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

2016-07-29 Thread David Malcolm
On Fri, 2016-07-29 at 21:42 +, Joseph Myers wrote: > 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.

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

2016-07-29 Thread Joseph Myers
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.

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

2016-07-29 Thread David Malcolm
On Fri, 2016-07-29 at 17:53 +0100, Manuel López-Ibáñez wrote: > On 29 July 2016 at 16:25, David Malcolm wrote: > > > > FWIW, it appears that clang uses the on-demand approach; the > > relevant > > code appears to be StringLiteral::getLocationOfByte: > >

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

2016-07-29 Thread Manuel López-Ibáñez
On 29 July 2016 at 16:25, David Malcolm wrote: > > FWIW, it appears that clang uses the on-demand approach; the relevant > code appears to be StringLiteral::getLocationOfByte: > http://clang.llvm.org/doxygen/Expr_8cpp_source.html#l01008 As far as I know, llvm doesn't do

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

2016-07-29 Thread David Malcolm
On Fri, 2016-07-29 at 10:46 -0400, David Malcolm wrote: > On Fri, 2016-07-29 at 08:22 -0600, Martin Sebor wrote: > > > Currently all that we need from the C family of frontends is the > > > cpp_reader and the string concatenation records. I think we can > > > reconstruct the cpp_reader if we have

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

2016-07-29 Thread David Malcolm
On Fri, 2016-07-29 at 08:22 -0600, Martin Sebor wrote: > > Currently all that we need from the C family of frontends is the > > cpp_reader and the string concatenation records. I think we can > > reconstruct the cpp_reader if we have the options, though > > presumably > > that's per TU, so to

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

2016-07-29 Thread Martin Sebor
Currently all that we need from the C family of frontends is the cpp_reader and the string concatenation records. I think we can reconstruct the cpp_reader if we have the options, though presumably that's per TU, so to support all this we'd need to capture e.g. the per -TU encoding information

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

2016-07-29 Thread David Malcolm
On Thu, 2016-07-28 at 15:16 -0600, Martin Sebor wrote: > On 07/28/2016 02:38 PM, Martin Sebor wrote: > > On 07/28/2016 02:12 PM, David Malcolm wrote: > > > On Wed, 2016-07-27 at 23:41 +0100, Manuel López-Ibáñez wrote: > > > > On 27 July 2016 at 15:30, David Malcolm > > > >

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

2016-07-28 Thread Martin Sebor
On 07/28/2016 02:38 PM, Martin Sebor wrote: On 07/28/2016 02:12 PM, David Malcolm wrote: On Wed, 2016-07-27 at 23:41 +0100, Manuel López-Ibáñez wrote: On 27 July 2016 at 15:30, David Malcolm wrote: Perhaps it could live for now in c-format.c, since it is the only place

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

2016-07-28 Thread Martin Sebor
On 07/28/2016 02:12 PM, David Malcolm wrote: On Wed, 2016-07-27 at 23:41 +0100, Manuel López-Ibáñez wrote: On 27 July 2016 at 15:30, David Malcolm wrote: Perhaps it could live for now in c-format.c, since it is the only place using it? Martin Sebor [CC-ed] wants to use

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

2016-07-28 Thread David Malcolm
On Wed, 2016-07-27 at 23:41 +0100, Manuel López-Ibáñez wrote: > On 27 July 2016 at 15:30, David Malcolm wrote: > > > Perhaps it could live for now in c-format.c, since it is the only > > > place using it? > > > > Martin Sebor [CC-ed] wants to use it from the middle-end: > >

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

2016-07-27 Thread Manuel López-Ibáñez
On 27 July 2016 at 15:30, David Malcolm wrote: >> Perhaps it could live for now in c-format.c, since it is the only >> place using it? > > Martin Sebor [CC-ed] wants to use it from the middle-end: > https://gcc.gnu.org/ml/gcc-patches/2016-07/msg01088.html > so it's unclear

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

2016-07-27 Thread David Malcolm
On Tue, 2016-07-26 at 19:05 +0100, Manuel López-Ibáñez wrote: > On 26/07/16 18:11, David Malcolm wrote: > > > gcc/ChangeLog: > > * gcc.c (cpp_options): Rename string to... > > (cpp_options_): ...this, to avoid clashing with struct in > > cpplib.h. > > It seems to me that you need

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

2016-07-26 Thread Manuel López-Ibáñez
On 26/07/16 18:11, David Malcolm wrote: gcc/ChangeLog: * gcc.c (cpp_options): Rename string to... (cpp_options_): ...this, to avoid clashing with struct in cpplib.h. It seems to me that you need this because now gcc.c includes cpplib.h via input.h, which seems wrong.