summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Schleifer <js@heap.zone>2018-04-23 01:42:20 +0200
committerJonathan Schleifer <js@heap.zone>2018-04-23 01:42:20 +0200
commit6c36590e51f2d1f42064e3fa15b000df9d839e5d (patch)
tree3d292973a31f35313f5fbd7138a236b9a3303202
parent819bc471170dfbc55597be886760a0959eb2e06e (diff)
Make all tests pass on AmigaOS 3
Note: There is still some weirdness in the compiler. Instead of m68k-amigaos-gcc, you need to use m68k-amigaos-g++ as OBJC, as otherwise exceptions don't work. Before running the tests, you need to run "stack 8192".
-rw-r--r--configure.ac34
-rw-r--r--src/OFString.m4
-rw-r--r--src/OFSystemInfo.m2
-rw-r--r--src/objfw-defs.h.in25
-rw-r--r--tests/OFStringTests.m14
5 files changed, 16 insertions, 63 deletions
diff --git a/configure.ac b/configure.ac
index cdaf3aa5..f7e53d0a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -41,38 +41,8 @@ case "$host" in
AC_DEFINE(LLONG_MIN, [(-0x7FFFFFFFFFFFFFFFLL - 1)],
[Minimum value for long long])
- AC_DEFINE(PRId8, "hhd", [Format string for 8-bit as decimal])
- AC_DEFINE(PRId16, "hd", [Format string for 16-bit as decimal])
- AC_DEFINE(PRId32, "d", [Format string for 32-bit as decimal])
- AC_DEFINE(PRId64, "lld", [Format string for 64-bit as decimal])
- AC_DEFINE(PRIi8, "hhi", [Format string for 8-bit as integer])
- AC_DEFINE(PRIi16, "hi", [Format string for 16-bit as integer])
- AC_DEFINE(PRIi32, "i", [Format string for 32-bit as integer])
- AC_DEFINE(PRIi64, "lli", [Format string for 64-bit as integer])
- AC_DEFINE(PRIo8, "hho", [Format string for 8-bit as octal])
- AC_DEFINE(PRIo16, "ho", [Format string for 16-bit as octal])
- AC_DEFINE(PRIo32, "o", [Format string for 32-bit as octal])
- AC_DEFINE(PRIo64, "llo", [Format string for 64-bit as octal])
- AC_DEFINE(PRIu8, "hhu", [Format string for 8-bit as unsigned])
- AC_DEFINE(PRIu16, "hu", [Format string for 16-bit as unsigned])
- AC_DEFINE(PRIu32, "u", [Format string for 32-bit as unsigned])
- AC_DEFINE(PRIu64, "llu", [Format string for 64-bit as unsigned])
- AC_DEFINE(PRIx8, "hhx",
- [Format string for 8-bit as lowercase hex])
- AC_DEFINE(PRIx16, "hx",
- [Format string for 16-bit as lowercase hex])
- AC_DEFINE(PRIx32, "x",
- [Format string for 32-bit as lowercase hex])
- AC_DEFINE(PRIx64, "llx",
- [Format string for 64-bit as lowercase hex])
- AC_DEFINE(PRIX8, "hhX",
- [Format string for 8-bit as uppercase hex])
- AC_DEFINE(PRIX16, "hX",
- [Format string for 16-bit as uppercase hex])
- AC_DEFINE(PRIX32, "X",
- [Format string for 32-bit as uppercase hex])
- AC_DEFINE(PRIX64, "llX",
- [Format string for 64-bit as uppercase hex])
+ AC_DEFINE(__have_longlong64, 1,
+ [Required for AmigaOS to correctly define PRI?64])
AC_SUBST(NOIXEMUL, -noixemul)
;;
diff --git a/src/OFString.m b/src/OFString.m
index 4ee8d5cc..4a5cf44f 100644
--- a/src/OFString.m
+++ b/src/OFString.m
@@ -2506,7 +2506,7 @@ decomposedString(OFString *self, const char *const *const *table, size_t size)
{
void *pool = objc_autoreleasePoolPush();
-#ifdef OF_MORPHOS
+#if defined(OF_AMIGAOS3) || defined(OF_MORPHOS)
OFString *stripped = [self stringByDeletingEnclosingWhitespaces];
if ([stripped caseInsensitiveCompare: @"INF"] == OF_ORDERED_SAME ||
@@ -2556,7 +2556,7 @@ decomposedString(OFString *self, const char *const *const *table, size_t size)
{
void *pool = objc_autoreleasePoolPush();
-#ifdef OF_MORPHOS
+#if defined(OF_AMIGAOS3) || defined(OF_MORPHOS)
OFString *stripped = [self stringByDeletingEnclosingWhitespaces];
if ([stripped caseInsensitiveCompare: @"INF"] == OF_ORDERED_SAME ||
diff --git a/src/OFSystemInfo.m b/src/OFSystemInfo.m
index ac3a40cc..dcd6beae 100644
--- a/src/OFSystemInfo.m
+++ b/src/OFSystemInfo.m
@@ -113,6 +113,8 @@ initOperatingSystemName(void)
operatingSystemName = @"Windows";
#elif defined(OF_ANDROID)
operatingSystemName = @"Android";
+#elif defined(OF_AMIGAOS3)
+ operatingSystemName = @"AmigaOS";
#elif defined(OF_MORPHOS)
operatingSystemName = @"MorphOS";
#elif defined(OF_AMIGAOS4)
diff --git a/src/objfw-defs.h.in b/src/objfw-defs.h.in
index ae101663..af64f4dd 100644
--- a/src/objfw-defs.h.in
+++ b/src/objfw-defs.h.in
@@ -41,30 +41,7 @@
#undef OF_NINTENDO_DS
#undef OF_OBJFW_RUNTIME
#undef OF_UNIVERSAL
-#undef PRId8
-#undef PRId16
-#undef PRId32
-#undef PRId64
-#undef PRIi8
-#undef PRIi16
-#undef PRIi32
-#undef PRIi64
-#undef PRIo8
-#undef PRIo16
-#undef PRIo32
-#undef PRIo64
-#undef PRIu8
-#undef PRIu16
-#undef PRIu32
-#undef PRIu64
-#undef PRIx8
-#undef PRIx16
-#undef PRIx32
-#undef PRIx64
-#undef PRIX8
-#undef PRIX16
-#undef PRIX32
-#undef PRIX64
#undef SIZE_MAX
#undef UINTPTR_MAX
#undef ULLONG_MAX
+#undef __have_longlong64
diff --git a/tests/OFStringTests.m b/tests/OFStringTests.m
index fa93a7d5..a8c1cd31 100644
--- a/tests/OFStringTests.m
+++ b/tests/OFStringTests.m
@@ -878,20 +878,24 @@ static uint16_t sutf16str[] = {
*/
TEST(@"-[floatValue]",
[C(@"\t-0.25 ") floatValue] == -0.25 &&
- [C(@"\r\n\tINF\t\n") doubleValue] == INFINITY &&
+ [C(@"\r\n\tINF\t\n") floatValue] == INFINITY &&
[C(@"\r -INFINITY\n") floatValue] == -INFINITY &&
isnan([C(@" NAN\t\t") floatValue]))
-#if !defined(OF_ANDROID) && !defined(OF_SOLARIS) && !defined(OF_DJGPP)
+#if !defined(OF_ANDROID) && !defined(OF_SOLARIS) && !defined(OF_DJGPP) && \
+ !defined(OF_AMIGAOS3)
# define INPUT @"\t-0x1.FFFFFFFFFFFFFP-1020 "
# define EXPECTED -0x1.FFFFFFFFFFFFFP-1020
#else
-/* Android, Solaris and DJGPP do not accept 0x for strtod() */
-# if !defined(OF_SOLARIS) || !defined(OF_X86)
+/* Android, Solaris, DJGPP and AmigaOS3 do not accept 0x for strtod() */
+# if (!defined(OF_SOLARIS) || !defined(OF_X86)) && !defined(OF_AMIGAOS3)
# define INPUT @"\t-0.123456789 "
# define EXPECTED -0.123456789
# else
-/* Solaris' strtod() has weird rounding on x86, but not on x86_64 */
+/*
+ * Solaris' strtod() has weird rounding on x86, but not on x86_64/
+ * AmigaOS 3 with libnix has weird rounding as well.
+ */
# define INPUT @"\t-0.125 "
# define EXPECTED -0.125
# endif