From owner-svn-src-stable-11@freebsd.org Fri Feb 21 21:57:30 2020 Return-Path: Delivered-To: svn-src-stable-11@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 EAE98244E4C; Fri, 21 Feb 2020 21:57:29 +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 48PQL06LNZz4h3l; Fri, 21 Feb 2020 21:57:28 +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 BC70619546; Fri, 21 Feb 2020 21:57:28 +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 01LLvS8V003446; Fri, 21 Feb 2020 21:57:28 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01LLvQVu003436; Fri, 21 Feb 2020 21:57:26 GMT (envelope-from dim@FreeBSD.org) Message-Id: <202002212157.01LLvQVu003436@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 21 Feb 2020 21:57:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r358230 - in stable: 11/lib/libc/quad 12/lib/libc/quad X-SVN-Group: stable-11 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 11/lib/libc/quad 12/lib/libc/quad X-SVN-Commit-Revision: 358230 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Feb 2020 21:57:30 -0000 Author: dim Date: Fri Feb 21 21:57:24 2020 New Revision: 358230 URL: https://svnweb.freebsd.org/changeset/base/358230 Log: MFC r358046: 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)) ^ ~~~~~~~~~~~~~~~ Modified: stable/11/lib/libc/quad/fixdfdi.c stable/11/lib/libc/quad/fixsfdi.c stable/11/lib/libc/quad/fixunsdfdi.c stable/11/lib/libc/quad/fixunssfdi.c stable/11/lib/libc/quad/floatdidf.c stable/11/lib/libc/quad/floatdisf.c stable/11/lib/libc/quad/floatunsdidf.c stable/11/lib/libc/quad/qdivrem.c stable/11/lib/libc/quad/quad.h Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/lib/libc/quad/fixdfdi.c stable/12/lib/libc/quad/fixsfdi.c stable/12/lib/libc/quad/fixunsdfdi.c stable/12/lib/libc/quad/fixunssfdi.c stable/12/lib/libc/quad/floatdidf.c stable/12/lib/libc/quad/floatdisf.c stable/12/lib/libc/quad/floatunsdidf.c stable/12/lib/libc/quad/qdivrem.c stable/12/lib/libc/quad/quad.h Directory Properties: stable/12/ (props changed) Modified: stable/11/lib/libc/quad/fixdfdi.c ============================================================================== --- stable/11/lib/libc/quad/fixdfdi.c Fri Feb 21 21:54:03 2020 (r358229) +++ stable/11/lib/libc/quad/fixdfdi.c Fri Feb 21 21:57:24 2020 (r358230) @@ -48,12 +48,12 @@ __fixdfdi(x) 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: stable/11/lib/libc/quad/fixsfdi.c ============================================================================== --- stable/11/lib/libc/quad/fixsfdi.c Fri Feb 21 21:54:03 2020 (r358229) +++ stable/11/lib/libc/quad/fixsfdi.c Fri Feb 21 21:57:24 2020 (r358230) @@ -49,12 +49,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: stable/11/lib/libc/quad/fixunsdfdi.c ============================================================================== --- stable/11/lib/libc/quad/fixunsdfdi.c Fri Feb 21 21:54:03 2020 (r358229) +++ stable/11/lib/libc/quad/fixunsdfdi.c Fri Feb 21 21:57:24 2020 (r358230) @@ -39,7 +39,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) @@ -83,11 +83,11 @@ __fixunsdfdi(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: stable/11/lib/libc/quad/fixunssfdi.c ============================================================================== --- stable/11/lib/libc/quad/fixunssfdi.c Fri Feb 21 21:54:03 2020 (r358229) +++ stable/11/lib/libc/quad/fixunssfdi.c Fri Feb 21 21:57:24 2020 (r358230) @@ -39,7 +39,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) @@ -87,11 +87,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: stable/11/lib/libc/quad/floatdidf.c ============================================================================== --- stable/11/lib/libc/quad/floatdidf.c Fri Feb 21 21:54:03 2020 (r358229) +++ stable/11/lib/libc/quad/floatdidf.c Fri Feb 21 21:57:24 2020 (r358230) @@ -65,7 +65,7 @@ __floatdidf(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: stable/11/lib/libc/quad/floatdisf.c ============================================================================== --- stable/11/lib/libc/quad/floatdisf.c Fri Feb 21 21:54:03 2020 (r358229) +++ stable/11/lib/libc/quad/floatdisf.c Fri Feb 21 21:57:24 2020 (r358230) @@ -67,7 +67,7 @@ __floatdisf(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: stable/11/lib/libc/quad/floatunsdidf.c ============================================================================== --- stable/11/lib/libc/quad/floatunsdidf.c Fri Feb 21 21:54:03 2020 (r358229) +++ stable/11/lib/libc/quad/floatunsdidf.c Fri Feb 21 21:57:24 2020 (r358230) @@ -51,7 +51,7 @@ __floatunsdidf(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: stable/11/lib/libc/quad/qdivrem.c ============================================================================== --- stable/11/lib/libc/quad/qdivrem.c Fri Feb 21 21:54:03 2020 (r358229) +++ stable/11/lib/libc/quad/qdivrem.c Fri Feb 21 21:57:24 2020 (r358230) @@ -44,7 +44,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: stable/11/lib/libc/quad/quad.h ============================================================================== --- stable/11/lib/libc/quad/quad.h Fri Feb 21 21:54:03 2020 (r358229) +++ stable/11/lib/libc/quad/quad.h Fri Feb 21 21:57:24 2020 (r358230) @@ -89,7 +89,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);