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     37   		AC_DEFINE(ULLONG_MAX, 0xFFFFFFFFFFFFFFFFULL,
    38     38   			[Maximum value for unsigned long long])
    39     39   		AC_DEFINE(LLONG_MAX, 0x7FFFFFFFFFFFFFFFLL,
    40     40   			[Maximum value for long long])
    41     41   		AC_DEFINE(LLONG_MIN, [(-0x7FFFFFFFFFFFFFFFLL - 1)],
    42     42   			[Minimum value for long long])
    43     43   
    44         -		AC_DEFINE(PRId8, "hhd", [Format string for 8-bit as decimal])
    45         -		AC_DEFINE(PRId16, "hd", [Format string for 16-bit as decimal])
    46         -		AC_DEFINE(PRId32, "d", [Format string for 32-bit as decimal])
    47         -		AC_DEFINE(PRId64, "lld", [Format string for 64-bit as decimal])
    48         -		AC_DEFINE(PRIi8, "hhi", [Format string for 8-bit as integer])
    49         -		AC_DEFINE(PRIi16, "hi", [Format string for 16-bit as integer])
    50         -		AC_DEFINE(PRIi32, "i", [Format string for 32-bit as integer])
    51         -		AC_DEFINE(PRIi64, "lli", [Format string for 64-bit as integer])
    52         -		AC_DEFINE(PRIo8, "hho", [Format string for 8-bit as octal])
    53         -		AC_DEFINE(PRIo16, "ho", [Format string for 16-bit as octal])
    54         -		AC_DEFINE(PRIo32, "o", [Format string for 32-bit as octal])
    55         -		AC_DEFINE(PRIo64, "llo", [Format string for 64-bit as octal])
    56         -		AC_DEFINE(PRIu8, "hhu", [Format string for 8-bit as unsigned])
    57         -		AC_DEFINE(PRIu16, "hu", [Format string for 16-bit as unsigned])
    58         -		AC_DEFINE(PRIu32, "u", [Format string for 32-bit as unsigned])
    59         -		AC_DEFINE(PRIu64, "llu", [Format string for 64-bit as unsigned])
    60         -		AC_DEFINE(PRIx8, "hhx",
    61         -			[Format string for 8-bit as lowercase hex])
    62         -		AC_DEFINE(PRIx16, "hx",
    63         -			[Format string for 16-bit as lowercase hex])
    64         -		AC_DEFINE(PRIx32, "x",
    65         -			[Format string for 32-bit as lowercase hex])
    66         -		AC_DEFINE(PRIx64, "llx",
    67         -			[Format string for 64-bit as lowercase hex])
    68         -		AC_DEFINE(PRIX8, "hhX",
    69         -			[Format string for 8-bit as uppercase hex])
    70         -		AC_DEFINE(PRIX16, "hX",
    71         -			[Format string for 16-bit as uppercase hex])
    72         -		AC_DEFINE(PRIX32, "X",
    73         -			[Format string for 32-bit as uppercase hex])
    74         -		AC_DEFINE(PRIX64, "llX",
    75         -			[Format string for 64-bit as uppercase hex])
           44  +		AC_DEFINE(__have_longlong64, 1,
           45  +			[Required for AmigaOS to correctly define PRI?64])
    76     46   
    77     47   		AC_SUBST(NOIXEMUL, -noixemul)
    78     48   		;;
    79     49   	powerpc-*-amigaos*)
    80     50   		enable_shared="no"
    81     51   		enable_threads="no"
    82     52   		;;

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

  2502   2502   	return value;
  2503   2503   }
  2504   2504   
  2505   2505   - (float)floatValue
  2506   2506   {
  2507   2507   	void *pool = objc_autoreleasePoolPush();
  2508   2508   
  2509         -#ifdef OF_MORPHOS
         2509  +#if defined(OF_AMIGAOS3) || defined(OF_MORPHOS)
  2510   2510   	OFString *stripped = [self stringByDeletingEnclosingWhitespaces];
  2511   2511   
  2512   2512   	if ([stripped caseInsensitiveCompare: @"INF"] == OF_ORDERED_SAME ||
  2513   2513   	    [stripped caseInsensitiveCompare: @"INFINITY"] == OF_ORDERED_SAME)
  2514   2514   		return INFINITY;
  2515   2515   	if ([stripped caseInsensitiveCompare: @"-INF"] == OF_ORDERED_SAME ||
  2516   2516   	    [stripped caseInsensitiveCompare: @"-INFINITY"] == OF_ORDERED_SAME)
................................................................................
  2552   2552   	return value;
  2553   2553   }
  2554   2554   
  2555   2555   - (double)doubleValue
  2556   2556   {
  2557   2557   	void *pool = objc_autoreleasePoolPush();
  2558   2558   
  2559         -#ifdef OF_MORPHOS
         2559  +#if defined(OF_AMIGAOS3) || defined(OF_MORPHOS)
  2560   2560   	OFString *stripped = [self stringByDeletingEnclosingWhitespaces];
  2561   2561   
  2562   2562   	if ([stripped caseInsensitiveCompare: @"INF"] == OF_ORDERED_SAME ||
  2563   2563   	    [stripped caseInsensitiveCompare: @"INFINITY"] == OF_ORDERED_SAME)
  2564   2564   		return INFINITY;
  2565   2565   	if ([stripped caseInsensitiveCompare: @"-INF"] == OF_ORDERED_SAME ||
  2566   2566   	    [stripped caseInsensitiveCompare: @"-INFINITY"] == OF_ORDERED_SAME)

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

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

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

    37     37   #undef OF_HAVE_THREADS
    38     38   #undef OF_HAVE_UNICODE_TABLES
    39     39   #undef OF_HAVE__THREAD_LOCAL
    40     40   #undef OF_HAVE___THREAD
    41     41   #undef OF_NINTENDO_DS
    42     42   #undef OF_OBJFW_RUNTIME
    43     43   #undef OF_UNIVERSAL
    44         -#undef PRId8
    45         -#undef PRId16
    46         -#undef PRId32
    47         -#undef PRId64
    48         -#undef PRIi8
    49         -#undef PRIi16
    50         -#undef PRIi32
    51         -#undef PRIi64
    52         -#undef PRIo8
    53         -#undef PRIo16
    54         -#undef PRIo32
    55         -#undef PRIo64
    56         -#undef PRIu8
    57         -#undef PRIu16
    58         -#undef PRIu32
    59         -#undef PRIu64
    60         -#undef PRIx8
    61         -#undef PRIx16
    62         -#undef PRIx32
    63         -#undef PRIx64
    64         -#undef PRIX8
    65         -#undef PRIX16
    66         -#undef PRIX32
    67         -#undef PRIX64
    68     44   #undef SIZE_MAX
    69     45   #undef UINTPTR_MAX
    70     46   #undef ULLONG_MAX
           47  +#undef __have_longlong64

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

   874    874   
   875    875   	/*
   876    876   	 * These test numbers can be generated without rounding if we have IEEE
   877    877   	 * floating point numbers, thus we can use == on them.
   878    878   	 */
   879    879   	TEST(@"-[floatValue]",
   880    880   	    [C(@"\t-0.25 ") floatValue] == -0.25 &&
   881         -	    [C(@"\r\n\tINF\t\n") doubleValue] == INFINITY &&
          881  +	    [C(@"\r\n\tINF\t\n") floatValue] == INFINITY &&
   882    882   	    [C(@"\r -INFINITY\n") floatValue] == -INFINITY &&
   883    883   	    isnan([C(@"   NAN\t\t") floatValue]))
   884    884   
   885         -#if !defined(OF_ANDROID) && !defined(OF_SOLARIS) && !defined(OF_DJGPP)
          885  +#if !defined(OF_ANDROID) && !defined(OF_SOLARIS) && !defined(OF_DJGPP) && \
          886  +    !defined(OF_AMIGAOS3)
   886    887   # define INPUT @"\t-0x1.FFFFFFFFFFFFFP-1020 "
   887    888   # define EXPECTED -0x1.FFFFFFFFFFFFFP-1020
   888    889   #else
   889         -/* Android, Solaris and DJGPP do not accept 0x for strtod() */
   890         -# if !defined(OF_SOLARIS) || !defined(OF_X86)
          890  +/* Android, Solaris, DJGPP and AmigaOS3 do not accept 0x for strtod() */
          891  +# if (!defined(OF_SOLARIS) || !defined(OF_X86)) && !defined(OF_AMIGAOS3)
   891    892   #  define INPUT @"\t-0.123456789 "
   892    893   #  define EXPECTED -0.123456789
   893    894   # else
   894         -/* Solaris' strtod() has weird rounding on x86, but not on x86_64 */
          895  +/*
          896  + * Solaris' strtod() has weird rounding on x86, but not on x86_64/
          897  + * AmigaOS 3 with libnix has weird rounding as well.
          898  + */
   895    899   #  define INPUT @"\t-0.125 "
   896    900   #  define EXPECTED -0.125
   897    901   # endif
   898    902   #endif
   899    903   	TEST(@"-[doubleValue]",
   900    904   	    [INPUT doubleValue] == EXPECTED &&
   901    905   	    [C(@"\r\n\tINF\t\n") doubleValue] == INFINITY &&