From ebf9911649f6596128493c5965f5b5638a029812 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 19 Oct 2010 09:42:48 +0000 Subject: SWORD25: Work around for bug in Mac OS X 10.2 SDK svn-id: r53604 --- engines/sword25/util/lua/lmathlib.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'engines/sword25/util') diff --git a/engines/sword25/util/lua/lmathlib.cpp b/engines/sword25/util/lua/lmathlib.cpp index fd9c69681f..ed50539f1f 100644 --- a/engines/sword25/util/lua/lmathlib.cpp +++ b/engines/sword25/util/lua/lmathlib.cpp @@ -252,7 +252,17 @@ LUALIB_API int luaopen_math (lua_State *L) { luaL_register(L, LUA_MATHLIBNAME, mathlib); lua_pushnumber(L, PI); lua_setfield(L, -2, "pi"); +#if defined(MACOSX) && defined(__GNUC__) && ! defined( __XLC__ ) + // WORKAROUND for a bug in the Mac OS X 10.2.8 SDK. It defines + // HUGE_VAL simply to 1e500, leading to this compiler error: + // error: floating constant exceeds range of 'double' + // However, GCC (at least the version we are using for our cross + // compiler) has a __builtin_huge_val which returns the correct + // value, so we just use that. + lua_pushnumber(L, __builtin_huge_val()); +#else lua_pushnumber(L, HUGE_VAL); +#endif lua_setfield(L, -2, "huge"); #if defined(LUA_COMPAT_MOD) lua_getfield(L, -1, "fmod"); -- cgit v1.2.3