This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] libebl: Fix missing brackets around if statement body.


On Sat, Jan 09, 2016 at 10:26:46PM +0100, Mark Wielaard wrote:
> GCC6 [will have] a nice new warning that showed a real bug:
> 
> elfutils/libebl/eblobjnote.c: In function ‘ebl_object_note’:
> elfutils/libebl/eblobjnote.c:135:5: error: statement is indented as if it were guarded by... [-Werror=misleading-indentation]
>     switch (type)
>     ^~~~~~
> 
> elfutils/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. Added brackets (and reindent).

I pushed this to master because the actual bug fix is really small.
It just looks big because of the reindentation, but the diff -w is:

diff --git a/libebl/eblobjnote.c b/libebl/eblobjnote.c
index fa1eb93..f80a1a5 100644
--- a/libebl/eblobjnote.c
+++ b/libebl/eblobjnote.c
@@ -1,5 +1,5 @@
 /* Print contents of object file note.
-   Copyright (C) 2002, 2007, 2009, 2011, 2015 Red Hat, Inc.
+   Copyright (C) 2002, 2007, 2009, 2011, 2015, 2016 Red Hat, Inc.
    This file is part of elfutils.
    Written by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -43,6 +43,7 @@ ebl_object_note (Ebl *ebl, const char *name, uint32_t type,
                 uint32_t descsz, const char *desc)
 {
   if (! ebl->object_note (name, type, descsz, desc))
+    {
       /* The machine specific function did not know this type.  */
 
       if (strcmp ("stapsdt", name) == 0)
@@ -229,3 +230,4 @@ ebl_object_note (Ebl *ebl, const char *name, uint32_t type,
          break;
        }
     }
+}

And so that 0.165 will build out of the box with GCC6.

Cheers,

Mark

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]