1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-12-22 19:43:42 +01:00

Remove unnecessary calls to labs()

Greetings,

Roman reports that Clang warns on unnecessary calls to labs():

  taking the absolute value of unsigned type 'unw_word_t' (aka
'unsigned long') has no effect [-Werror,-Wabsolute-value]

Since rs->reg[...].val is unw_word_t and unsigned on all platforms,
this patch removes the unnecessary calls to labs().

Tested on Linux x86_64, no regressions.

Thanks,
--
Paul Pluzhnikov
This commit is contained in:
Paul Pluzhnikov 2014-07-29 13:27:43 -07:00 committed by Arun Sharma
parent dbce594d33
commit e63cadf76d

View file

@ -50,17 +50,17 @@ tdep_stash_frame (struct dwarf_cursor *d, struct dwarf_reg_state *rs)
&& (rs->reg[DWARF_CFA_REG_COLUMN].where == DWARF_WHERE_REG)
&& (rs->reg[DWARF_CFA_REG_COLUMN].val == RBP
|| rs->reg[DWARF_CFA_REG_COLUMN].val == RSP)
&& labs(rs->reg[DWARF_CFA_OFF_COLUMN].val) < (1 << 29)
&& rs->reg[DWARF_CFA_OFF_COLUMN].val < (1 << 29)
&& DWARF_GET_LOC(d->loc[d->ret_addr_column]) == d->cfa-8
&& (rs->reg[RBP].where == DWARF_WHERE_UNDEF
|| rs->reg[RBP].where == DWARF_WHERE_SAME
|| (rs->reg[RBP].where == DWARF_WHERE_CFAREL
&& labs(rs->reg[RBP].val) < (1 << 14)
&& rs->reg[RBP].val < (1 << 14)
&& rs->reg[RBP].val+1 != 0))
&& (rs->reg[RSP].where == DWARF_WHERE_UNDEF
|| rs->reg[RSP].where == DWARF_WHERE_SAME
|| (rs->reg[RSP].where == DWARF_WHERE_CFAREL
&& labs(rs->reg[RSP].val) < (1 << 14)
&& rs->reg[RSP].val < (1 << 14)
&& rs->reg[RSP].val+1 != 0)))
{
/* Save information for a standard frame. */