From nobody Sun Feb 8 13:17:03 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1656644012; cv=none; d=zohomail.com; s=zohoarc; b=SNEOHWHhcuDFTdxsPvofINetsBsJ7bd8yq8dIEYnFu0Cco4aE0xjhY7dK52ptk//HVXy2zZ7Ap5xWJ04hbi9vV+N7WqLqe9y5wkVZAvsQVQmmpPLaxxP3JkPN2csjTvLXzeGvJNgNo8EpLbN89zszM2cBgDWAa1EPfZmpqzm1UE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1656644012; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=emJIzaXU33jokcSSZk15QMiAvLvTJVyhadkqR2/7Mwg=; b=iMqNd6dRVmLybd3ETtV7fwNIdD+thqLiH8bhfBzlB7YsTBoJc8/EBvHuwUaczNBPl0C3BAYw0NtxuHEukDtCYA//VWMpEUnlOhujYPS0GDererMEf6nlIbqlTIii6zztqU2F8daI1SDu8Jy2r21H0Bfh3vTHACSPe8Ndhv2RIqk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656644012430258.829605763636; Thu, 30 Jun 2022 19:53:32 -0700 (PDT) Received: from localhost ([::1]:41992 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o76mg-0006pK-Tc for importer@patchew.org; Thu, 30 Jun 2022 22:53:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36298) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o76kw-00067J-K3 for qemu-devel@nongnu.org; Thu, 30 Jun 2022 22:51:42 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:36309) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o76kt-0000hN-B8 for qemu-devel@nongnu.org; Thu, 30 Jun 2022 22:51:41 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-425-8F8RYlKgMEi8JD_3gF284A-1; Thu, 30 Jun 2022 22:51:36 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9B9DC811E75; Fri, 1 Jul 2022 02:51:35 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8C8052026D64; Fri, 1 Jul 2022 02:51:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656643897; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=emJIzaXU33jokcSSZk15QMiAvLvTJVyhadkqR2/7Mwg=; b=bHGs2L4Uaxk9NLCtnSeZ0M8llr+8L/ElKAWlJTY66H125a/Rxe8uxtcZhnD2M0IZyLvvar N0bn9APjZugQWRB0MtkBlAkr73obsZfSujry/yz51xvp1VexDbb8BQPGmucLzpLf1WSD/K QNSXEcacRixonstF/We5VmutghVtDoU= X-MC-Unique: 8F8RYlKgMEi8JD_3gF284A-1 From: Thomas Huth To: qemu-devel@nongnu.org, Richard Henderson Cc: Peter Maydell Subject: [PATCH] include/qemu/host-utils: Remove unused code in the *_overflow wrappers Date: Fri, 1 Jul 2022 04:51:32 +0200 Message-Id: <20220701025132.303469-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1656644013852100001 Content-Type: text/plain; charset="utf-8" According to commit cec07c0b612975 the code in the #else paths was required for GCC < 5.0 and Clang < 3.8. We don't support such old compilers at all anymore, so we can remove these lines now. We keep the wrapper function, though, since they are easier to read and help to make sure that the parameters have the right types. Signed-off-by: Thomas Huth Reviewed-by: Richard Henderson --- include/qemu/host-utils.h | 65 --------------------------------------- 1 file changed, 65 deletions(-) diff --git a/include/qemu/host-utils.h b/include/qemu/host-utils.h index bc743f5e32..29f3a99878 100644 --- a/include/qemu/host-utils.h +++ b/include/qemu/host-utils.h @@ -376,12 +376,7 @@ static inline uint64_t uabs64(int64_t v) */ static inline bool sadd32_overflow(int32_t x, int32_t y, int32_t *ret) { -#if __has_builtin(__builtin_add_overflow) || __GNUC__ >=3D 5 return __builtin_add_overflow(x, y, ret); -#else - *ret =3D x + y; - return ((*ret ^ x) & ~(x ^ y)) < 0; -#endif } =20 /** @@ -394,12 +389,7 @@ static inline bool sadd32_overflow(int32_t x, int32_t = y, int32_t *ret) */ static inline bool sadd64_overflow(int64_t x, int64_t y, int64_t *ret) { -#if __has_builtin(__builtin_add_overflow) || __GNUC__ >=3D 5 return __builtin_add_overflow(x, y, ret); -#else - *ret =3D x + y; - return ((*ret ^ x) & ~(x ^ y)) < 0; -#endif } =20 /** @@ -412,12 +402,7 @@ static inline bool sadd64_overflow(int64_t x, int64_t = y, int64_t *ret) */ static inline bool uadd32_overflow(uint32_t x, uint32_t y, uint32_t *ret) { -#if __has_builtin(__builtin_add_overflow) || __GNUC__ >=3D 5 return __builtin_add_overflow(x, y, ret); -#else - *ret =3D x + y; - return *ret < x; -#endif } =20 /** @@ -430,12 +415,7 @@ static inline bool uadd32_overflow(uint32_t x, uint32_= t y, uint32_t *ret) */ static inline bool uadd64_overflow(uint64_t x, uint64_t y, uint64_t *ret) { -#if __has_builtin(__builtin_add_overflow) || __GNUC__ >=3D 5 return __builtin_add_overflow(x, y, ret); -#else - *ret =3D x + y; - return *ret < x; -#endif } =20 /** @@ -449,12 +429,7 @@ static inline bool uadd64_overflow(uint64_t x, uint64_= t y, uint64_t *ret) */ static inline bool ssub32_overflow(int32_t x, int32_t y, int32_t *ret) { -#if __has_builtin(__builtin_sub_overflow) || __GNUC__ >=3D 5 return __builtin_sub_overflow(x, y, ret); -#else - *ret =3D x - y; - return ((*ret ^ x) & (x ^ y)) < 0; -#endif } =20 /** @@ -468,12 +443,7 @@ static inline bool ssub32_overflow(int32_t x, int32_t = y, int32_t *ret) */ static inline bool ssub64_overflow(int64_t x, int64_t y, int64_t *ret) { -#if __has_builtin(__builtin_sub_overflow) || __GNUC__ >=3D 5 return __builtin_sub_overflow(x, y, ret); -#else - *ret =3D x - y; - return ((*ret ^ x) & (x ^ y)) < 0; -#endif } =20 /** @@ -487,12 +457,7 @@ static inline bool ssub64_overflow(int64_t x, int64_t = y, int64_t *ret) */ static inline bool usub32_overflow(uint32_t x, uint32_t y, uint32_t *ret) { -#if __has_builtin(__builtin_sub_overflow) || __GNUC__ >=3D 5 return __builtin_sub_overflow(x, y, ret); -#else - *ret =3D x - y; - return x < y; -#endif } =20 /** @@ -506,12 +471,7 @@ static inline bool usub32_overflow(uint32_t x, uint32_= t y, uint32_t *ret) */ static inline bool usub64_overflow(uint64_t x, uint64_t y, uint64_t *ret) { -#if __has_builtin(__builtin_sub_overflow) || __GNUC__ >=3D 5 return __builtin_sub_overflow(x, y, ret); -#else - *ret =3D x - y; - return x < y; -#endif } =20 /** @@ -524,13 +484,7 @@ static inline bool usub64_overflow(uint64_t x, uint64_= t y, uint64_t *ret) */ static inline bool smul32_overflow(int32_t x, int32_t y, int32_t *ret) { -#if __has_builtin(__builtin_mul_overflow) || __GNUC__ >=3D 5 return __builtin_mul_overflow(x, y, ret); -#else - int64_t z =3D (int64_t)x * y; - *ret =3D z; - return *ret !=3D z; -#endif } =20 /** @@ -543,14 +497,7 @@ static inline bool smul32_overflow(int32_t x, int32_t = y, int32_t *ret) */ static inline bool smul64_overflow(int64_t x, int64_t y, int64_t *ret) { -#if __has_builtin(__builtin_mul_overflow) || __GNUC__ >=3D 5 return __builtin_mul_overflow(x, y, ret); -#else - uint64_t hi, lo; - muls64(&lo, &hi, x, y); - *ret =3D lo; - return hi !=3D ((int64_t)lo >> 63); -#endif } =20 /** @@ -563,13 +510,7 @@ static inline bool smul64_overflow(int64_t x, int64_t = y, int64_t *ret) */ static inline bool umul32_overflow(uint32_t x, uint32_t y, uint32_t *ret) { -#if __has_builtin(__builtin_mul_overflow) || __GNUC__ >=3D 5 return __builtin_mul_overflow(x, y, ret); -#else - uint64_t z =3D (uint64_t)x * y; - *ret =3D z; - return z > UINT32_MAX; -#endif } =20 /** @@ -582,13 +523,7 @@ static inline bool umul32_overflow(uint32_t x, uint32_= t y, uint32_t *ret) */ static inline bool umul64_overflow(uint64_t x, uint64_t y, uint64_t *ret) { -#if __has_builtin(__builtin_mul_overflow) || __GNUC__ >=3D 5 return __builtin_mul_overflow(x, y, ret); -#else - uint64_t hi; - mulu64(ret, &hi, x, y); - return hi !=3D 0; -#endif } =20 /* --=20 2.31.1