From owner-svn-src-all@freebsd.org Mon Feb 17 20:24:24 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1F0CA245D0F; Mon, 17 Feb 2020 20:24:24 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48LwSS04Whz4SYp; Mon, 17 Feb 2020 20:24:23 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E63DACB4D; Mon, 17 Feb 2020 20:24:23 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01HKON5w077469; Mon, 17 Feb 2020 20:24:23 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01HKOMVc077458; Mon, 17 Feb 2020 20:24:22 GMT (envelope-from dim@FreeBSD.org) Message-Id: <202002172024.01HKOMVc077458@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 17 Feb 2020 20:24:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r358046 - head/lib/libc/quad X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/lib/libc/quad X-SVN-Commit-Revision: 358046 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Feb 2020 20:24:24 -0000 Author: dim Date: Mon Feb 17 20:24:21 2020 New Revision: 358046 URL: https://svnweb.freebsd.org/changeset/base/358046 Log: Merge r358042 from the clang1000-import branch: Add casts and L suffixes to libc quad support, to work around various -Werror warnings from clang 10.0.0, such as: lib/libc/quad/fixdfdi.c:57:12: error: implicit conversion from 'long long' to 'double' changes value from 9223372036854775807 to 9223372036854775808 [-Werror,-Wimplicit-int-float-conversion] if (x >= QUAD_MAX) ~~ ^~~~~~~~ /usr/obj/usr/src/powerpc.powerpc/tmp/usr/include/sys/limits.h:89:19: note: expanded from macro 'QUAD_MAX' #define QUAD_MAX (__QUAD_MAX) /* max value for a quad_t */ ^~~~~~~~~~ /usr/obj/usr/src/powerpc.powerpc/tmp/usr/include/machine/_limits.h:91:20: note: expanded from macro '__QUAD_MAX' #define __QUAD_MAX __LLONG_MAX /* max value for a quad_t */ ^~~~~~~~~~~ /usr/obj/usr/src/powerpc.powerpc/tmp/usr/include/machine/_limits.h:75:21: note: expanded from macro '__LLONG_MAX' #define __LLONG_MAX 0x7fffffffffffffffLL /* max value for a long long */ ^~~~~~~~~~~~~~~~~~~~ and many instances of: lib/libc/quad/fixunsdfdi.c:73:17: error: shift count >= width of type [-Werror,-Wshift-count-overflow] toppart = (x - ONE_HALF) / ONE; ^~~~~~~~ lib/libc/quad/fixunsdfdi.c:45:19: note: expanded from macro 'ONE_HALF' #define ONE_HALF (ONE_FOURTH * 2.0) ^~~~~~~~~~ lib/libc/quad/fixunsdfdi.c:44:23: note: expanded from macro 'ONE_FOURTH' #define ONE_FOURTH (1 << (LONG_BITS - 2)) ^ ~~~~~~~~~~~~~~~ lib/libc/quad/fixunsdfdi.c:73:29: error: shift count >= width of type [-Werror,-Wshift-count-overflow] toppart = (x - ONE_HALF) / ONE; ^~~ lib/libc/quad/fixunsdfdi.c:46:15: note: expanded from macro 'ONE' #define ONE (ONE_FOURTH * 4.0) ^~~~~~~~~~ lib/libc/quad/fixunsdfdi.c:44:23: note: expanded from macro 'ONE_FOURTH' #define ONE_FOURTH (1 << (LONG_BITS - 2)) ^ ~~~~~~~~~~~~~~~ MFC after: 3 days Modified: head/lib/libc/quad/fixdfdi.c head/lib/libc/quad/fixsfdi.c head/lib/libc/quad/fixunsdfdi.c head/lib/libc/quad/fixunssfdi.c head/lib/libc/quad/floatdidf.c head/lib/libc/quad/floatdisf.c head/lib/libc/quad/floatunsdidf.c head/lib/libc/quad/qdivrem.c head/lib/libc/quad/quad.h Directory Properties: head/ (props changed) Modified: head/lib/libc/quad/fixdfdi.c ============================================================================== --- head/lib/libc/quad/fixdfdi.c Mon Feb 17 20:23:26 2020 (r358045) +++ head/lib/libc/quad/fixdfdi.c Mon Feb 17 20:24:21 2020 (r358046) @@ -49,12 +49,12 @@ quad_t __fixdfdi(double x) { if (x < 0) - if (x <= QUAD_MIN) + if (x <= (double)QUAD_MIN) return (QUAD_MIN); else return ((quad_t)-(u_quad_t)-x); else - if (x >= QUAD_MAX) + if (x >= (double)QUAD_MAX) return (QUAD_MAX); else return ((quad_t)(u_quad_t)x); Modified: head/lib/libc/quad/fixsfdi.c ============================================================================== --- head/lib/libc/quad/fixsfdi.c Mon Feb 17 20:23:26 2020 (r358045) +++ head/lib/libc/quad/fixsfdi.c Mon Feb 17 20:24:21 2020 (r358046) @@ -51,12 +51,12 @@ long long __fixsfdi(float x) { if (x < 0) - if (x <= QUAD_MIN) + if (x <= (float)QUAD_MIN) return (QUAD_MIN); else return ((quad_t)-(u_quad_t)-x); else - if (x >= QUAD_MAX) + if (x >= (float)QUAD_MAX) return (QUAD_MAX); else return ((quad_t)(u_quad_t)x); Modified: head/lib/libc/quad/fixunsdfdi.c ============================================================================== --- head/lib/libc/quad/fixunsdfdi.c Mon Feb 17 20:23:26 2020 (r358045) +++ head/lib/libc/quad/fixunsdfdi.c Mon Feb 17 20:24:21 2020 (r358046) @@ -41,7 +41,7 @@ __FBSDID("$FreeBSD$"); #include "quad.h" -#define ONE_FOURTH (1 << (LONG_BITS - 2)) +#define ONE_FOURTH (1L << (LONG_BITS - 2)) #define ONE_HALF (ONE_FOURTH * 2.0) #define ONE (ONE_FOURTH * 4.0) @@ -84,11 +84,11 @@ __fixunsdfdi(double x) x -= (double)t.uq; if (x < 0) { t.ul[H]--; - x += ULONG_MAX; + x += (double)ULONG_MAX; } - if (x > ULONG_MAX) { + if (x > (double)ULONG_MAX) { t.ul[H]++; - x -= ULONG_MAX; + x -= (double)ULONG_MAX; } t.ul[L] = (u_long)x; return (t.uq); Modified: head/lib/libc/quad/fixunssfdi.c ============================================================================== --- head/lib/libc/quad/fixunssfdi.c Mon Feb 17 20:23:26 2020 (r358045) +++ head/lib/libc/quad/fixunssfdi.c Mon Feb 17 20:24:21 2020 (r358046) @@ -41,7 +41,7 @@ __FBSDID("$FreeBSD$"); #include "quad.h" -#define ONE_FOURTH (1 << (LONG_BITS - 2)) +#define ONE_FOURTH (1L << (LONG_BITS - 2)) #define ONE_HALF (ONE_FOURTH * 2.0) #define ONE (ONE_FOURTH * 4.0) @@ -89,11 +89,11 @@ __fixunssfdi(float f) x -= (double)t.uq; if (x < 0) { t.ul[H]--; - x += ULONG_MAX; + x += (double)ULONG_MAX; } - if (x > ULONG_MAX) { + if (x > (double)ULONG_MAX) { t.ul[H]++; - x -= ULONG_MAX; + x -= (double)ULONG_MAX; } t.ul[L] = (u_long)x; return (t.uq); Modified: head/lib/libc/quad/floatdidf.c ============================================================================== --- head/lib/libc/quad/floatdidf.c Mon Feb 17 20:23:26 2020 (r358045) +++ head/lib/libc/quad/floatdidf.c Mon Feb 17 20:24:21 2020 (r358046) @@ -66,7 +66,7 @@ __floatdidf(quad_t x) * code and does not know how to get at an exponent. Machine- * specific code may be able to do this more efficiently. */ - d = (double)u.ul[H] * ((1 << (LONG_BITS - 2)) * 4.0); + d = (double)u.ul[H] * ((1L << (LONG_BITS - 2)) * 4.0); d += u.ul[L]; return (neg ? -d : d); Modified: head/lib/libc/quad/floatdisf.c ============================================================================== --- head/lib/libc/quad/floatdisf.c Mon Feb 17 20:23:26 2020 (r358045) +++ head/lib/libc/quad/floatdisf.c Mon Feb 17 20:24:21 2020 (r358046) @@ -68,7 +68,7 @@ __floatdisf(quad_t x) * * Using double here may be excessive paranoia. */ - f = (double)u.ul[H] * ((1 << (LONG_BITS - 2)) * 4.0); + f = (double)u.ul[H] * ((1L << (LONG_BITS - 2)) * 4.0); f += u.ul[L]; return (neg ? -f : f); Modified: head/lib/libc/quad/floatunsdidf.c ============================================================================== --- head/lib/libc/quad/floatunsdidf.c Mon Feb 17 20:23:26 2020 (r358045) +++ head/lib/libc/quad/floatunsdidf.c Mon Feb 17 20:24:21 2020 (r358046) @@ -52,7 +52,7 @@ __floatunsdidf(u_quad_t x) union uu u; u.uq = x; - d = (double)u.ul[H] * ((1 << (LONG_BITS - 2)) * 4.0); + d = (double)u.ul[H] * ((1L << (LONG_BITS - 2)) * 4.0); d += u.ul[L]; return (d); } Modified: head/lib/libc/quad/qdivrem.c ============================================================================== --- head/lib/libc/quad/qdivrem.c Mon Feb 17 20:23:26 2020 (r358045) +++ head/lib/libc/quad/qdivrem.c Mon Feb 17 20:24:21 2020 (r358046) @@ -46,7 +46,7 @@ __FBSDID("$FreeBSD$"); #include "quad.h" -#define B (1 << HALF_BITS) /* digit base */ +#define B (1L << HALF_BITS) /* digit base */ /* Combine two `digits' to make a single two-digit number. */ #define COMBINE(a, b) (((u_long)(a) << HALF_BITS) | (b)) Modified: head/lib/libc/quad/quad.h ============================================================================== --- head/lib/libc/quad/quad.h Mon Feb 17 20:23:26 2020 (r358045) +++ head/lib/libc/quad/quad.h Mon Feb 17 20:24:21 2020 (r358046) @@ -91,7 +91,7 @@ union uu { * (sizeof(long)*CHAR_BIT/2). */ #define HHALF(x) ((x) >> HALF_BITS) -#define LHALF(x) ((x) & ((1 << HALF_BITS) - 1)) +#define LHALF(x) ((x) & ((1L << HALF_BITS) - 1)) #define LHUP(x) ((x) << HALF_BITS) int __cmpdi2(quad_t a, quad_t b);