ObjFW  Check-in [49cb6ada5f]

Overview
Comment: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".

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 49cb6ada5f8e15f4daad81ff16ef0418c8a6d93c38fa4b01ba6bdab78a9faf11
User & Date: js on 2018-04-22 23:42:20
Other Links: manifest | tags
Context
2018-04-23
22:19
Use more native AmigaOS APIs on AmigaOS 3 check-in: b16fc262c0 user: js tags: trunk
2018-04-22
23:42
Make all tests pass on AmigaOS 3 check-in: 49cb6ada5f user: js tags: trunk
18:52
Relink everything if libobjfw_rt.a changed check-in: 4c7b3ee778 user: js tags: trunk
Changes

Modified configure.ac from [50d23c6b89] to [c90d8efdd2].

37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75

76
77
78
79
80
81
82
		AC_DEFINE(ULLONG_MAX, 0xFFFFFFFFFFFFFFFFULL,
			[Maximum value for unsigned long long])
		AC_DEFINE(LLONG_MAX, 0x7FFFFFFFFFFFFFFFLL,
			[Maximum value for long long])
		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_SUBST(NOIXEMUL, -noixemul)
		;;
	powerpc-*-amigaos*)
		enable_shared="no"
		enable_threads="no"
		;;







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
>







37
38
39
40
41
42
43




















44











45
46
47
48
49
50
51
52
		AC_DEFINE(ULLONG_MAX, 0xFFFFFFFFFFFFFFFFULL,
			[Maximum value for unsigned long long])
		AC_DEFINE(LLONG_MAX, 0x7FFFFFFFFFFFFFFFLL,
			[Maximum value for long long])
		AC_DEFINE(LLONG_MIN, [(-0x7FFFFFFFFFFFFFFFLL - 1)],
			[Minimum value for long long])





















		AC_DEFINE(__have_longlong64, 1,











			[Required for AmigaOS to correctly define PRI?64])

		AC_SUBST(NOIXEMUL, -noixemul)
		;;
	powerpc-*-amigaos*)
		enable_shared="no"
		enable_threads="no"
		;;

Modified src/OFString.m from [1882c89ea1] to [2d7f2091d4].

2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
....
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
	return value;
}

- (float)floatValue
{
	void *pool = objc_autoreleasePoolPush();

#ifdef OF_MORPHOS
	OFString *stripped = [self stringByDeletingEnclosingWhitespaces];

	if ([stripped caseInsensitiveCompare: @"INF"] == OF_ORDERED_SAME ||
	    [stripped caseInsensitiveCompare: @"INFINITY"] == OF_ORDERED_SAME)
		return INFINITY;
	if ([stripped caseInsensitiveCompare: @"-INF"] == OF_ORDERED_SAME ||
	    [stripped caseInsensitiveCompare: @"-INFINITY"] == OF_ORDERED_SAME)
................................................................................
	return value;
}

- (double)doubleValue
{
	void *pool = objc_autoreleasePoolPush();

#ifdef OF_MORPHOS
	OFString *stripped = [self stringByDeletingEnclosingWhitespaces];

	if ([stripped caseInsensitiveCompare: @"INF"] == OF_ORDERED_SAME ||
	    [stripped caseInsensitiveCompare: @"INFINITY"] == OF_ORDERED_SAME)
		return INFINITY;
	if ([stripped caseInsensitiveCompare: @"-INF"] == OF_ORDERED_SAME ||
	    [stripped caseInsensitiveCompare: @"-INFINITY"] == OF_ORDERED_SAME)







|







 







|







2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
....
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
	return value;
}

- (float)floatValue
{
	void *pool = objc_autoreleasePoolPush();

#if defined(OF_AMIGAOS3) || defined(OF_MORPHOS)
	OFString *stripped = [self stringByDeletingEnclosingWhitespaces];

	if ([stripped caseInsensitiveCompare: @"INF"] == OF_ORDERED_SAME ||
	    [stripped caseInsensitiveCompare: @"INFINITY"] == OF_ORDERED_SAME)
		return INFINITY;
	if ([stripped caseInsensitiveCompare: @"-INF"] == OF_ORDERED_SAME ||
	    [stripped caseInsensitiveCompare: @"-INFINITY"] == OF_ORDERED_SAME)
................................................................................
	return value;
}

- (double)doubleValue
{
	void *pool = objc_autoreleasePoolPush();

#if defined(OF_AMIGAOS3) || defined(OF_MORPHOS)
	OFString *stripped = [self stringByDeletingEnclosingWhitespaces];

	if ([stripped caseInsensitiveCompare: @"INF"] == OF_ORDERED_SAME ||
	    [stripped caseInsensitiveCompare: @"INFINITY"] == OF_ORDERED_SAME)
		return INFINITY;
	if ([stripped caseInsensitiveCompare: @"-INF"] == OF_ORDERED_SAME ||
	    [stripped caseInsensitiveCompare: @"-INFINITY"] == OF_ORDERED_SAME)

Modified src/OFSystemInfo.m from [d70c261d5b] to [a6ae61b1e9].

109
110
111
112
113
114
115


116
117
118
119
120
121
122
	operatingSystemName = @"iOS";
#elif defined(OF_MACOS)
	operatingSystemName = @"macOS";
#elif defined(OF_WINDOWS)
	operatingSystemName = @"Windows";
#elif defined(OF_ANDROID)
	operatingSystemName = @"Android";


#elif defined(OF_MORPHOS)
	operatingSystemName = @"MorphOS";
#elif defined(OF_AMIGAOS4)
	operatingSystemName = @"AmigaOS 4";
#elif defined(OF_WII)
	operatingSystemName = @"Nintendo Wii";
#elif defined(NINTENDO_3DS)







>
>







109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
	operatingSystemName = @"iOS";
#elif defined(OF_MACOS)
	operatingSystemName = @"macOS";
#elif defined(OF_WINDOWS)
	operatingSystemName = @"Windows";
#elif defined(OF_ANDROID)
	operatingSystemName = @"Android";
#elif defined(OF_AMIGAOS3)
	operatingSystemName = @"AmigaOS";
#elif defined(OF_MORPHOS)
	operatingSystemName = @"MorphOS";
#elif defined(OF_AMIGAOS4)
	operatingSystemName = @"AmigaOS 4";
#elif defined(OF_WII)
	operatingSystemName = @"Nintendo Wii";
#elif defined(NINTENDO_3DS)

Modified src/objfw-defs.h.in from [63d5610c05] to [558f07b729].

37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70

#undef OF_HAVE_THREADS
#undef OF_HAVE_UNICODE_TABLES
#undef OF_HAVE__THREAD_LOCAL
#undef OF_HAVE___THREAD
#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








<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<



>
37
38
39
40
41
42
43
























44
45
46
47
#undef OF_HAVE_THREADS
#undef OF_HAVE_UNICODE_TABLES
#undef OF_HAVE__THREAD_LOCAL
#undef OF_HAVE___THREAD
#undef OF_NINTENDO_DS
#undef OF_OBJFW_RUNTIME
#undef OF_UNIVERSAL
























#undef SIZE_MAX
#undef UINTPTR_MAX
#undef ULLONG_MAX
#undef __have_longlong64

Modified tests/OFStringTests.m from [38c5330f76] to [e81e35af26].

874
875
876
877
878
879
880
881
882
883
884
885

886
887
888
889
890
891
892
893

894


895
896
897
898
899
900
901

	/*
	 * These test numbers can be generated without rounding if we have IEEE
	 * floating point numbers, thus we can use == on them.
	 */
	TEST(@"-[floatValue]",
	    [C(@"\t-0.25 ") floatValue] == -0.25 &&
	    [C(@"\r\n\tINF\t\n") doubleValue] == INFINITY &&
	    [C(@"\r -INFINITY\n") floatValue] == -INFINITY &&
	    isnan([C(@"   NAN\t\t") floatValue]))

#if !defined(OF_ANDROID) && !defined(OF_SOLARIS) && !defined(OF_DJGPP)

# 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)
#  define INPUT @"\t-0.123456789 "
#  define EXPECTED -0.123456789
# else

/* Solaris' strtod() has weird rounding on x86, but not on x86_64 */


#  define INPUT @"\t-0.125 "
#  define EXPECTED -0.125
# endif
#endif
	TEST(@"-[doubleValue]",
	    [INPUT doubleValue] == EXPECTED &&
	    [C(@"\r\n\tINF\t\n") doubleValue] == INFINITY &&







|



|
>



|
|



>
|
>
>







874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905

	/*
	 * These test numbers can be generated without rounding if we have IEEE
	 * floating point numbers, thus we can use == on them.
	 */
	TEST(@"-[floatValue]",
	    [C(@"\t-0.25 ") floatValue] == -0.25 &&
	    [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) && \
    !defined(OF_AMIGAOS3)
# define INPUT @"\t-0x1.FFFFFFFFFFFFFP-1020 "
# define EXPECTED -0x1.FFFFFFFFFFFFFP-1020
#else
/* 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/
 * AmigaOS 3 with libnix has weird rounding as well.
 */
#  define INPUT @"\t-0.125 "
#  define EXPECTED -0.125
# endif
#endif
	TEST(@"-[doubleValue]",
	    [INPUT doubleValue] == EXPECTED &&
	    [C(@"\r\n\tINF\t\n") doubleValue] == INFINITY &&