On 03/03/2016 08:21 AM, David Malcolm wrote:
Comment #1 of PR c/68187 identified another overzealous warning
from -Wmisleading-indentation, with OpenSSL 1.0.1, on this poorly
indented code:
115 if (locked)
116 i = CRYPTO_add(&e->struct_ref, -1, CRYPTO_LOCK_ENGINE);
117 else
118 i = --e->struct_ref;
119 engine_ref_debug(e, 0, -1)
120 if (i > 0)
121 return 1;
Egad. How do people read this code when they have to understand it and
make changes. What a steaming pile of .....
Root cause is that "engine_ref_debug" is actually a debugging macro
that was empty in the given configuration, so the code effectively
was:
117 else // GUARD
118 i = --e->struct_ref; // BODY
119
120 if (i > 0) // NEXT
hence the warning.
No surprise we triggered seeing that.
OK for trunk?
Note: one of the new test cases adds a dg-warning/dg-message pair, and so
would require updating if/when the wording change posted here:
https://gcc.gnu.org/ml/gcc-patches/2016-03/msg00068.html
("[PATCH] PR c/69993: improvements to wording of -Wmisleading-indentation")
is applied.
gcc/c-family/ChangeLog:
PR c/68187
* c-indentation.c (get_visual_column): Move code to determine next
tab stop to...
(next_tab_stop): ...this new function.
(line_contains_hash_if): Delete function.
(detect_preprocessor_logic): Delete function.
(get_first_nws_vis_column): New function.
(detect_intervening_unindent): New function.
(should_warn_for_misleading_indentation): Replace call to
detect_preprocessor_logic with a call to
detect_intervening_unindent.
gcc/testsuite/ChangeLog:
PR c/68187
* c-c++-common/Wmisleading-indentation.c (fn_42_a): New test
function.
(fn_42_b): Likewise.
(fn_42_c): Likewise.
OK.
Jeff