diff options
author | Mark Wielaard <[email protected]> | 2015-09-15 10:55:10 +0200 |
---|---|---|
committer | Mark Wielaard <[email protected]> | 2015-09-15 11:00:50 +0200 |
commit | dd8bd91f39c95947ad14cd43d30c17eb8c2827fc (patch) | |
tree | 2e84d66afe2bba10de8a293824cf1839974dd3ed | |
parent | 2d982861e5e23d38653df7d8dce1d2282cda8ce1 (diff) |
libdw: Don't reassign result pointer in dwarf_peel_type.
GCC6 will warn about the reassignement of the nonnull result pointer.
The reassignment is indeed a little questionable. The compiler cannot
see that the pointer will not actually be reassigned since the function
will just return the same pointer value except when the dwarf_formref_die
function fails. In which case we don't use the result anymore. So the
compiler has to pessimistically assume the pointer will need to be
reloaded in the loop every time. Help the compiler generate slightly
better code by just checking whether the function fails directly instead
of reusing the pointer value for this.
Signed-off-by: Mark Wielaard <[email protected]>
-rw-r--r-- | libdw/ChangeLog | 4 | ||||
-rw-r--r-- | libdw/dwarf_peel_type.c | 5 |
2 files changed, 6 insertions, 3 deletions
diff --git a/libdw/ChangeLog b/libdw/ChangeLog index 13beefc7..2e27ff96 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,3 +1,7 @@ +2015-09-15 Mark Wielaard <[email protected]> + + * dwarf_peel_type.c (dwarf_peel_type): Don't reassign result pointer. + 2015-09-09 Chih-Hung Hsieh <[email protected]> * dwarf_macro_getsrcfiles.c (dwarf_macro_getsrcfiles): Remove diff --git a/libdw/dwarf_peel_type.c b/libdw/dwarf_peel_type.c index 9be838dd..7b29d35a 100644 --- a/libdw/dwarf_peel_type.c +++ b/libdw/dwarf_peel_type.c @@ -1,5 +1,5 @@ /* Peel type aliases and qualifier tags from a type DIE. - Copyright (C) 2014 Red Hat, Inc. + Copyright (C) 2014, 2015 Red Hat, Inc. This file is part of elfutils. This file is free software; you can redistribute it and/or modify @@ -60,8 +60,7 @@ dwarf_peel_type (die, result) if (attr == NULL) return 1; - result = INTUSE (dwarf_formref_die) (attr, result); - if (result == NULL) + if (INTUSE (dwarf_formref_die) (attr, result) == NULL) return -1; tag = INTUSE (dwarf_tag) (result); |