From owner-svn-src-head@freebsd.org Fri Feb 23 04:04:19 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 87EB2F24A28; Fri, 23 Feb 2018 04:04:19 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3B92E6A703; Fri, 23 Feb 2018 04:04:19 +0000 (UTC) (envelope-from imp@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 3663E1175A; Fri, 23 Feb 2018 04:04:19 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1N44JYt053781; Fri, 23 Feb 2018 04:04:19 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1N44IO7053779; Fri, 23 Feb 2018 04:04:18 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201802230404.w1N44IO7053779@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 23 Feb 2018 04:04:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329858 - head/contrib/lua/src X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/contrib/lua/src X-SVN-Commit-Revision: 329858 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 04:04:19 -0000 Author: imp Date: Fri Feb 23 04:04:18 2018 New Revision: 329858 URL: https://svnweb.freebsd.org/changeset/base/329858 Log: When the LUA_FLOAT_TYPE != LUA_FLOAT_INT64, we can't reference float or double so ifdef that code out when the numbers aren't float at all. There's still references in the lmathlib.c, but we don't compile that for the loader yet. Differential Revision: https://reviews.freebsd.org/D14472 Modified: head/contrib/lua/src/llimits.h head/contrib/lua/src/lstrlib.c Modified: head/contrib/lua/src/llimits.h ============================================================================== --- head/contrib/lua/src/llimits.h Fri Feb 23 04:04:03 2018 (r329857) +++ head/contrib/lua/src/llimits.h Fri Feb 23 04:04:18 2018 (r329858) @@ -66,7 +66,9 @@ typedef LUAI_USER_ALIGNMENT_T L_Umaxalign; #else typedef union { lua_Number n; +#if LUA_FLOAT_TYPE != LUA_FLOAT_INT64 double u; +#endif void *s; lua_Integer i; long l; Modified: head/contrib/lua/src/lstrlib.c ============================================================================== --- head/contrib/lua/src/lstrlib.c Fri Feb 23 04:04:03 2018 (r329857) +++ head/contrib/lua/src/lstrlib.c Fri Feb 23 04:04:18 2018 (r329858) @@ -1134,7 +1134,11 @@ static const union { /* dummy structure to get native alignment requirements */ struct cD { char c; - union { double d; void *p; lua_Integer i; lua_Number n; } u; + union { +#if LUA_FLOAT_TYPE != LUA_FLOAT_INT64 + double d; +#endif + void *p; lua_Integer i; lua_Number n; } u; }; #define MAXALIGN (offsetof(struct cD, u)) @@ -1144,8 +1148,10 @@ struct cD { ** Union for serializing floats */ typedef union Ftypes { +#if LUA_FLOAT_TYPE != LUA_FLOAT_INT64 float f; double d; +#endif lua_Number n; char buff[5 * sizeof(lua_Number)]; /* enough for any float type */ } Ftypes; @@ -1235,8 +1241,10 @@ static KOption getoption (Header *h, const char **fmt, case 'j': *size = sizeof(lua_Integer); return Kint; case 'J': *size = sizeof(lua_Integer); return Kuint; case 'T': *size = sizeof(size_t); return Kuint; +#if LUA_FLOAT_TYPE != LUA_FLOAT_INT64 case 'f': *size = sizeof(float); return Kfloat; case 'd': *size = sizeof(double); return Kfloat; +#endif case 'n': *size = sizeof(lua_Number); return Kfloat; case 'i': *size = getnumlimit(h, fmt, sizeof(int)); return Kint; case 'I': *size = getnumlimit(h, fmt, sizeof(int)); return Kuint; @@ -1369,9 +1377,13 @@ static int str_pack (lua_State *L) { volatile Ftypes u; char *buff = luaL_prepbuffsize(&b, size); lua_Number n = luaL_checknumber(L, arg); /* get argument */ +#if LUA_FLOAT_TYPE != LUA_FLOAT_INT64 if (size == sizeof(u.f)) u.f = (float)n; /* copy it into 'u' */ else if (size == sizeof(u.d)) u.d = (double)n; else u.n = n; +#else + u.n = n; +#endif /* move 'u' to final result, correcting endianness if needed */ copywithendian(buff, u.buff, size, h.islittle); luaL_addsize(&b, size); @@ -1507,9 +1519,13 @@ static int str_unpack (lua_State *L) { volatile Ftypes u; lua_Number num; copywithendian(u.buff, data + pos, size, h.islittle); +#if LUA_FLOAT_TYPE != LUA_FLOAT_INT64 if (size == sizeof(u.f)) num = (lua_Number)u.f; else if (size == sizeof(u.d)) num = (lua_Number)u.d; else num = u.n; +#else + num = u.n; +#endif lua_pushnumber(L, num); break; }