[PATCH] Refactor -Wmisleading-indentation API and extend coverage

2015-06-07 Thread Patrick Palka
This patch refactors the entry point of -Wmisleading-indentation from: void warn_for_misleading_indentation (location_t guard_loc, location_t body_loc, location_t next_stmt_loc, enum cpp_tt

Re: [PATCH] Refactor -Wmisleading-indentation API and extend coverage

2015-06-07 Thread Patrick Palka
The new heuristic turns out to trigger a common false positive (see test case below) in many programs. I have applied this diff on top of the original patch to make the heuristic more strict. diff --git a/gcc/c-family/c-indentation.c b/gcc/c-family/c-indentation.c index d3e842b..5532ff4 100644 -

Re: [PATCH] Refactor -Wmisleading-indentation API and extend coverage

2015-06-08 Thread David Malcolm
On Sun, 2015-06-07 at 16:06 -0400, Patrick Palka wrote: > This patch refactors the entry point of -Wmisleading-indentation Thanks for working on this. I was hoping to submit a patch to propose putting -Wmisleading-indentation into -Wall, and have been testing the warning on the linux kernel to tr

Re: [PATCH] Refactor -Wmisleading-indentation API and extend coverage

2015-06-08 Thread Richard Sandiford
Patrick Palka writes: > At the same time this patch extends the coverage of the > -Wmisleading-indentation implementation to catch misleading indentation > involving the semicolon. (These changes are all contained in > c-indentation.c.) For example, now we warn on the following code > samples: >

Re: [PATCH] Refactor -Wmisleading-indentation API and extend coverage

2015-06-08 Thread Patrick Palka
On Mon, Jun 8, 2015 at 2:11 PM, David Malcolm wrote: > On Sun, 2015-06-07 at 16:06 -0400, Patrick Palka wrote: >> This patch refactors the entry point of -Wmisleading-indentation > > Thanks for working on this. I was hoping to submit a patch to propose > putting -Wmisleading-indentation into -Wal

Re: [PATCH] Refactor -Wmisleading-indentation API and extend coverage

2015-06-08 Thread Patrick Palka
On Mon, Jun 8, 2015 at 2:45 PM, Richard Sandiford wrote: > Patrick Palka writes: >> At the same time this patch extends the coverage of the >> -Wmisleading-indentation implementation to catch misleading indentation >> involving the semicolon. (These changes are all contained in >> c-indentation.

Re: [PATCH] Refactor -Wmisleading-indentation API and extend coverage

2015-06-08 Thread Richard Sandiford
Patrick Palka writes: > On Mon, Jun 8, 2015 at 2:11 PM, David Malcolm wrote: >>> void >>> warn_for_misleading_indentation (const common_token_info &guard_tinfo, >>>const common_token_info &body_tinfo, >>>const common_toke