Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -737,39 +737,10 @@ ]) AS_IF([test x"$ac_cv_c_bigendian" = x"universal"], [ AC_DEFINE(OF_UNIVERSAL, 1, [Whether we are building a universal binary]) ]) -AC_MSG_CHECKING(for SIZE_MAX) -AC_EGREP_CPP(egrep_cpp_yes, [ - #include - #include - - #ifdef SIZE_MAX - egrep_cpp_yes - #endif -], [ - AC_MSG_RESULT(yes) -], [ - AC_MSG_RESULT(no) - AC_MSG_CHECKING(for SIZE_T_MAX) - AC_EGREP_CPP(egrep_cpp_yes, [ - #include - #include - - #ifdef SIZE_T_MAX - egrep_cpp_yes - #endif - ], [ - AC_MSG_RESULT(yes) - size_max="SIZE_T_MAX" - ], [ - AC_MSG_RESULT(no) - size_max="(~(size_t)0)" - ]) - AC_DEFINE_UNQUOTED(SIZE_MAX, $size_max, [Maximum value for size_t]) -]) AC_MSG_CHECKING(for SSIZE_MAX) AC_EGREP_CPP(egrep_cpp_yes, [ #include #include @@ -778,12 +749,11 @@ #endif ], [ AC_MSG_RESULT(yes) ], [ AC_MSG_RESULT(no) - AC_DEFINE(SSIZE_MAX, [((ssize_t)(SIZE_MAX / 2))], - [Maximum value for ssize_t]) + AC_DEFINE(SSIZE_MAX, [(SIZE_MAX / 2)], [Maximum value for ssize_t]) ]) AC_MSG_CHECKING(for UINTPTR_MAX) AC_EGREP_CPP(egrep_cpp_yes, [ #include #include @@ -793,11 +763,13 @@ #endif ], [ AC_MSG_RESULT(yes) ], [ AC_MSG_RESULT(no) - AC_DEFINE(UINTPTR_MAX, [(~(uintptr_t)0)], [Maximum value for uintptr_t]) + AC_CHECK_SIZEOF(uintptr_t) + AC_DEFINE(UINTPTR_MAX, + [(SIZEOF_UINTPTR_T * CHAR_BIT)], [Maximum value for uintptr_t]) ]) AC_CHECK_HEADER(inttypes.h, [AC_DEFINE(OF_HAVE_INTTYPES_H, 1, [Whether we have inttypes.h])]) @@ -843,41 +815,10 @@ AC_MSG_RESULT($fp_endianess) AS_IF([test x"$fp_endianess" = x"unknown"], [ AC_MSG_ERROR( [Floating point implementation does not conform to IEEE 754!])]) -AC_MSG_CHECKING(for INFINITY) -AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([ - #include - #include - ], [ - printf("%f", INFINITY); - ]) -], [ - AC_MSG_RESULT(yes) -], [ - AC_MSG_RESULT(no) - - AC_MSG_CHECKING(for __builtin_inf) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([ - #include - ], [ - printf("%f", __builtin_inf()); - ]) - ], [ - AC_MSG_RESULT(yes) - AC_DEFINE(INFINITY, [(__builtin_inf())], - [Workaround for missing INFINITY]) - ], [ - AC_MSG_RESULT(no) - - AC_MSG_ERROR([Neither INFINITY or __builtin_inf was found!]) - ]) -]) - case "$host_cpu" in arm* | earm*) AC_MSG_CHECKING(for VFP2 or above) AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([], [ Index: src/OFString+JSONParsing.m ================================================================== --- src/OFString+JSONParsing.m +++ src/OFString+JSONParsing.m @@ -29,10 +29,14 @@ #import "OFDictionary.h" #import "OFNumber.h" #import "OFNull.h" #import "OFInvalidJSONException.h" + +#ifndef INFINITY +# define INFINITY __builtin_inf() +#endif int _OFString_JSONParsing_reference; static id nextObject(const char **pointer, const char *stop, size_t *line, size_t depthLimit); Index: src/OFString.m ================================================================== --- src/OFString.m +++ src/OFString.m @@ -74,10 +74,14 @@ #ifdef OF_AMIGAOS_M68K /* libnix has strtod, but not strtof */ # define strtof strtod #endif + +#ifndef INFINITY +# define INFINITY __builtin_inf() +#endif static struct { Class isa; } placeholder; Index: src/objfw-defs.h.in ================================================================== --- src/objfw-defs.h.in +++ src/objfw-defs.h.in @@ -1,8 +1,5 @@ -#undef INFINITY -#undef LLONG_MAX -#undef LLONG_MIN #undef OF_APPLE_RUNTIME #undef OF_BIG_ENDIAN #undef OF_FLOAT_BIG_ENDIAN #undef OF_HAVE_ATOMIC_BUILTINS #undef OF_HAVE_ATOMIC_OPS @@ -46,9 +43,5 @@ #undef OF_NINTENDO_DS #undef OF_NO_SHARED #undef OF_OBJFW_RUNTIME #undef OF_UNIVERSAL #undef OF_WII -#undef SIZE_MAX -#undef UINTPTR_MAX -#undef ULLONG_MAX -#undef __have_longlong64 Index: tests/OFStringTests.m ================================================================== --- tests/OFStringTests.m +++ tests/OFStringTests.m @@ -24,10 +24,14 @@ #import "TestsAppDelegate.h" #import "OFString.h" #import "OFMutableUTF8String.h" #import "OFUTF8String.h" + +#ifndef INFINITY +# define INFINITY __builtin_inf() +#endif static OFString *module = nil; static OFString *whitespace[] = { @" \r \t\n\t \tasd \t \t\t\r\n", @" \t\t \t\t \t \t"