From: Florian Krohm Date: Mon, 9 Feb 2015 23:21:07 +0000 (+0000) Subject: Remove an unused macro (which also had undefined behaviours). X-Git-Tag: svn/VALGRIND_3_11_0^2~92 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5e34f3c37dcd9a11330c20493261e09b9d087f3a;p=thirdparty%2Fvalgrind.git Remove an unused macro (which also had undefined behaviours). git-svn-id: svn://svn.valgrind.org/vex/trunk@3090 --- diff --git a/VEX/priv/guest_s390_helpers.c b/VEX/priv/guest_s390_helpers.c index cf223c484e..622cdccf55 100644 --- a/VEX/priv/guest_s390_helpers.c +++ b/VEX/priv/guest_s390_helpers.c @@ -1566,7 +1566,7 @@ s390_calculate_cc(ULong cc_op, ULong cc_dep1, ULong cc_dep2, ULong cc_ndep) case S390_CC_OP_TEST_UNDER_MASK_16: { /* Create a TMLL insn with the mask as given by cc_dep2 */ - UInt insn = (0xA701 << 16) | cc_dep2; + UInt insn = (0xA701u << 16) | cc_dep2; UInt value = cc_dep1; __asm__ volatile ( diff --git a/VEX/priv/guest_s390_toIR.c b/VEX/priv/guest_s390_toIR.c index e066d10a38..96d4432f47 100644 --- a/VEX/priv/guest_s390_toIR.c +++ b/VEX/priv/guest_s390_toIR.c @@ -94,15 +94,6 @@ typedef enum { /*--- Helpers for constructing IR. ---*/ /*------------------------------------------------------------*/ -/* Sign extend a value with the given number of bits. This is a - macro because it allows us to overload the type of the value. - Note that VALUE must have a signed type! */ -#undef sign_extend -#define sign_extend(value,num_bits) \ -(((value) << (sizeof(__typeof__(value)) * 8 - (num_bits))) >> \ - (sizeof(__typeof__(value)) * 8 - (num_bits))) - - /* Add a statement to the current irsb. */ static __inline__ void stmt(IRStmt *st) diff --git a/VEX/priv/host_s390_defs.c b/VEX/priv/host_s390_defs.c index 1746baa972..ea2f718189 100644 --- a/VEX/priv/host_s390_defs.c +++ b/VEX/priv/host_s390_defs.c @@ -185,7 +185,8 @@ s390_hreg_guest_state_pointer(void) static __inline__ Bool fits_signed_20bit(Int value) { - return ((value << 12) >> 12) == value; + UInt uval = value; + return ((Int)(uval << 12) >> 12) == value; } @@ -4725,36 +4726,36 @@ s390_emit_LOCG(UChar *p, UChar r1, UChar m3, UChar b2, UShort dl2, UChar dh2) static __inline__ Bool uint_fits_signed_16bit(UInt val) { - Int v = val & 0xFFFFu; + UInt v = val & 0xFFFFu; /* sign extend */ - v = (v << 16) >> 16; + v = (Int)(v << 16) >> 16; - return val == (UInt)v; + return val == v; } static __inline__ Bool ulong_fits_signed_16bit(ULong val) { - Long v = val & 0xFFFFu; + ULong v = val & 0xFFFFu; /* sign extend */ - v = (v << 48) >> 48; + v = (Long)(v << 48) >> 48; - return val == (ULong)v; + return val == v; } static __inline__ Bool ulong_fits_signed_32bit(ULong val) { - Long v = val & 0xFFFFFFFFu; + ULong v = val & 0xFFFFFFFFu; /* sign extend */ - v = (v << 32) >> 32; + v = (Long)(v << 32) >> 32; - return val == (ULong)v; + return val == v; } diff --git a/VEX/priv/host_s390_isel.c b/VEX/priv/host_s390_isel.c index e8e6fc8f1d..f7af2a934c 100644 --- a/VEX/priv/host_s390_isel.c +++ b/VEX/priv/host_s390_isel.c @@ -268,22 +268,22 @@ ulong_fits_unsigned_12bit(ULong val) static __inline__ Bool ulong_fits_signed_20bit(ULong val) { - Long v = val & 0xFFFFFu; + ULong v = val & 0xFFFFFu; - v = (v << 44) >> 44; /* sign extend */ + v = (Long)(v << 44) >> 44; /* sign extend */ - return val == (ULong)v; + return val == v; } static __inline__ Bool ulong_fits_signed_8bit(ULong val) { - Long v = val & 0xFFu; + ULong v = val & 0xFFu; - v = (v << 56) >> 56; /* sign extend */ + v = (Long)(v << 56) >> 56; /* sign extend */ - return val == (ULong)v; + return val == v; } /* EXPR is an expression that is used as an address. Return an s390_amode @@ -463,13 +463,13 @@ s390_expr_is_const_zero(IRExpr *expr) static ULong get_const_value_as_ulong(const IRConst *con) { - Long value; + ULong value; switch (con->tag) { - case Ico_U1: value = con->Ico.U1; return (ULong) ((value << 63) >> 63); - case Ico_U8: value = con->Ico.U8; return (ULong) ((value << 56) >> 56); - case Ico_U16: value = con->Ico.U16; return (ULong) ((value << 48) >> 48); - case Ico_U32: value = con->Ico.U32; return (ULong) ((value << 32) >> 32); + case Ico_U1: value = con->Ico.U1; return ((Long)(value << 63) >> 63); + case Ico_U8: value = con->Ico.U8; return ((Long)(value << 56) >> 56); + case Ico_U16: value = con->Ico.U16; return ((Long)(value << 48) >> 48); + case Ico_U32: value = con->Ico.U32; return ((Long)(value << 32) >> 32); case Ico_U64: return con->Ico.U64; default: vpanic("get_const_value_as_ulong"); diff --git a/VEX/priv/s390_disasm.c b/VEX/priv/s390_disasm.c index 6a52409f38..95cf1f770c 100644 --- a/VEX/priv/s390_disasm.c +++ b/VEX/priv/s390_disasm.c @@ -246,7 +246,7 @@ static HChar * dxb_operand(HChar *p, UInt d, UInt x, UInt b, Bool displacement_is_signed) { if (displacement_is_signed) { - Int displ = ((Int)d << 12) >> 12; /* sign extend */ + Int displ = (Int)(d << 12) >> 12; /* sign extend */ p += vex_sprintf(p, "%d", displ); } else { @@ -399,15 +399,15 @@ s390_disasm(UInt command, ...) break; case S390_ARG_PCREL: { - Int offset = (Int)(va_arg(args, UInt)); + Long offset = va_arg(args, Int); /* Convert # halfwords to # bytes */ offset <<= 1; if (offset < 0) { - p += vex_sprintf(p, ".%d", offset); + p += vex_sprintf(p, ".%lld", offset); } else { - p += vex_sprintf(p, ".+%u", offset); + p += vex_sprintf(p, ".+%lld", offset); } break; }