Re: [PATCH v3 1/2] [PR debug/67192] Fix C loops' back-jump location

2015-11-09 Thread Andreas Krebbel
On 11/04/2015 05:17 PM, Andreas Arnez wrote: > Since r223098 ("Implement -Wmisleading-indentation") the backward-jump > generated for a C while- or for-loop can get the wrong line number. > This is because the check for misleading indentation peeks ahead one > token, advancing input_location to aft

Re: [PATCH v3 1/2] [PR debug/67192] Fix C loops' back-jump location

2015-11-06 Thread Jeff Law
On 11/04/2015 09:17 AM, Andreas Arnez wrote: Since r223098 ("Implement -Wmisleading-indentation") the backward-jump generated for a C while- or for-loop can get the wrong line number. This is because the check for misleading indentation peeks ahead one token, advancing input_location to after the

Re: [PATCH v3 1/2] [PR debug/67192] Fix C loops' back-jump location

2015-11-05 Thread Andreas Arnez
On Thu, Nov 05 2015, Bernd Schmidt wrote: > On 11/05/2015 12:33 PM, Andreas Arnez wrote: > >> Thanks again for reviewing. Are you going to look at patch #2 as well? > > Yeah, still thinking about that one. > >>> Does C++ have similar issues? >> >> Not this particular issue, AFAIK. But I've just

Re: [PATCH v3 1/2] [PR debug/67192] Fix C loops' back-jump location

2015-11-05 Thread Bernd Schmidt
On 11/05/2015 12:33 PM, Andreas Arnez wrote: Thanks again for reviewing. Are you going to look at patch #2 as well? Yeah, still thinking about that one. Does C++ have similar issues? Not this particular issue, AFAIK. But I've just looked at how C++ fares with the enhanced version of pr67

Re: [PATCH v3 1/2] [PR debug/67192] Fix C loops' back-jump location

2015-11-05 Thread Andreas Arnez
On Thu, Nov 05 2015, Bernd Schmidt wrote: > On 11/04/2015 05:17 PM, Andreas Arnez wrote: >> >> gcc/c/ChangeLog: >> >> PR debug/67192 >> * c-parser.c (c_parser_while_statement): Finish the loop before >> parsing ahead for misleading indentation. >> (c_parser_for_statement): Like

Re: [PATCH v3 1/2] [PR debug/67192] Fix C loops' back-jump location

2015-11-05 Thread Bernd Schmidt
On 11/04/2015 05:17 PM, Andreas Arnez wrote: gcc/c/ChangeLog: PR debug/67192 * c-parser.c (c_parser_while_statement): Finish the loop before parsing ahead for misleading indentation. (c_parser_for_statement): Likewise. This is OK. Does C++ have similar issues?

[PATCH v3 1/2] [PR debug/67192] Fix C loops' back-jump location

2015-11-04 Thread Andreas Arnez
Since r223098 ("Implement -Wmisleading-indentation") the backward-jump generated for a C while- or for-loop can get the wrong line number. This is because the check for misleading indentation peeks ahead one token, advancing input_location to after the loop, and then c_finish_loop() creates the bac

Re: [PATCH v2] [PR debug/67192] Fix C loops' back-jump location

2015-11-04 Thread Andreas Arnez
On Thu, Oct 29 2015, Andreas Arnez wrote: > On Thu, Oct 29 2015, Bernd Schmidt wrote: >> [...] >> i.e. the breakpoint on the code inside the loop is reached before the >> while statement itself. This may be the expected behaviour with your >> patch, but I'm not sure it's really desirable for debug

Re: [PATCH v2] [PR debug/67192] Fix C loops' back-jump location

2015-10-29 Thread Andreas Arnez
On Thu, Oct 29 2015, Bernd Schmidt wrote: > On 10/23/2015 11:14 AM, Andreas Arnez wrote: >> + bool is_braced = c_parser_next_token_is (parser, CPP_OPEN_BRACE); >> body = c_parser_c99_block_statement (parser); >> + location_t iter_loc = is_braced ? input_location : loc; >> >> token_indent

Re: [PATCH v2] [PR debug/67192] Fix C loops' back-jump location

2015-10-29 Thread Bernd Schmidt
On 10/23/2015 11:14 AM, Andreas Arnez wrote: This patch adds a new parameter to c_finish_loop that expclitly specifies the location to be used for the loop iteration. All calls to c_finish_loop are adjusted accordingly. I think the general principle of this is probably ok. + bool is_braced

Re: [PATCH v2] [PR debug/67192] Fix C loops' back-jump location

2015-10-29 Thread Andreas Arnez
Ping: https://gcc.gnu.org/ml/gcc-patches/2015-10/msg02393.html On Fri, Oct 23 2015, Andreas Arnez wrote: > After parsing an unconditional "while"- or "for"-loop, the C front-end > generates a backward-goto statement and implicitly sets its location to > the current input_location. But in some

[PATCH v2] [PR debug/67192] Fix C loops' back-jump location

2015-10-23 Thread Andreas Arnez
After parsing an unconditional "while"- or "for"-loop, the C front-end generates a backward-goto statement and implicitly sets its location to the current input_location. But in some cases the parser peeks ahead first, such that input_location already points to the line after the loop and the gene

Re: [PR debug/67192] Fix C loops' back-jump location

2015-10-23 Thread Andreas Arnez
On Tue, Oct 13 2015, Bernd Schmidt wrote: > One could argue that peek_token should not have an effect on > input_location, and in fact cpp_peek_token seems to take steps that > this does not happen, but it looks like c_parser_peek_token does not > use that mechanism. Yes, the C/C++ parsers differ

Re: [PR debug/67192] Fix C loops' back-jump location

2015-10-13 Thread Bernd Schmidt
On 10/12/2015 04:04 PM, Andreas Arnez wrote: Since r223098 ("Implement -Wmisleading-indentation") the backward-jump generated for a C while- or for-loop can get the wrong line number. This is because the check for misleading indentation peeks ahead one token, advancing input_location to after the

[PR debug/67192] Fix C loops' back-jump location

2015-10-12 Thread Andreas Arnez
Since r223098 ("Implement -Wmisleading-indentation") the backward-jump generated for a C while- or for-loop can get the wrong line number. This is because the check for misleading indentation peeks ahead one token, advancing input_location to after the loop, and then c_finish_loop() creates the bac