Skip to content
Snippets Groups Projects
  • Mark Wielaard's avatar
    a579cd9a
    Fix GCC6 -Wmisleading-indentation issues. · a579cd9a
    Mark Wielaard authored
    GCC6 will warn about misleading indentation issues like:
    
    gdb/ada-lang.c: In function ‘ada_evaluate_subexp’:
    ada-lang.c:11423:9: error: statement is indented as if it were guarded by...
             arg1 = unwrap_value (arg1);
             ^~~~
    
    gdb/ada-lang.c:11421:7: note: ...this ‘else’ clause, but it is not
           else
           ^~~~
    
    In this case it would be a bug except for the fact the if clause already
    returned early. So this misindented statement really only got executed
    for the else case. But it could easily mislead a reader, so adding a
    proper else block is the correct solution.
    
    In case of c-typeprint.c (c_type_print_base) the if statement is indeed
    misleadingly indented, but not a bug. Just indent correctly. The inflow.c
    (terminal_ours_1) misindented block comes from the removal of an if clause
    in commit d9d2d8b6 which looks correct. Just introduce an else to fixup the
    indentation of the block. The linux-record.c misleadingly indented return
    statements are just that. Misleading to the reader, but not actual bugs.
    Just unindent them so they don't look like they fall under the wrong if
    clause.
    a579cd9a
    History
    Fix GCC6 -Wmisleading-indentation issues.
    Mark Wielaard authored
    GCC6 will warn about misleading indentation issues like:
    
    gdb/ada-lang.c: In function ‘ada_evaluate_subexp’:
    ada-lang.c:11423:9: error: statement is indented as if it were guarded by...
             arg1 = unwrap_value (arg1);
             ^~~~
    
    gdb/ada-lang.c:11421:7: note: ...this ‘else’ clause, but it is not
           else
           ^~~~
    
    In this case it would be a bug except for the fact the if clause already
    returned early. So this misindented statement really only got executed
    for the else case. But it could easily mislead a reader, so adding a
    proper else block is the correct solution.
    
    In case of c-typeprint.c (c_type_print_base) the if statement is indeed
    misleadingly indented, but not a bug. Just indent correctly. The inflow.c
    (terminal_ours_1) misindented block comes from the removal of an if clause
    in commit d9d2d8b6 which looks correct. Just introduce an else to fixup the
    indentation of the block. The linux-record.c misleadingly indented return
    statements are just that. Misleading to the reader, but not actual bugs.
    Just unindent them so they don't look like they fall under the wrong if
    clause.