Looking forward to GCC6 – nice new warning -Wmisleading-indentation

The GNU Compiler Collection is making some great progress. Playing with the current development version I cannot wait till GCC6 is officially out. The new warnings look beautiful and are more useful because of the range tracking. Just found an embarrassing bug thanks to the new -Wmisleading-indentation

libebl/eblobjnote.c: In function ‘ebl_object_note’:
libebl/eblobjnote.c:135:5: error: statement is indented as if it were guarded by... [-Werror=misleading-indentation]
    switch (type)

libebl/eblobjnote.c:45:3: note: ...this ‘if’ clause, but it is not
  if (! ebl->object_note (name, type, descsz, desc))

And indeed, it should have been under the if, but wasn’t because of missing brackets. Woops. Thanks GCC.

One Comment

  1. […] donnera un avertissement. Il a déjà montré ses effets positifs pour une partie des elfutils : Mark Wielard a pu corriger un défaut « gênant » dans le code. Il doit cependant être […]