Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -22,10 +22,62 @@ dnl Used to disable checking for -pedantic on some platforms where it's broken check_pedantic="yes" case "$host" in + m68k-*-amigaos*) + OBJCFLAGS="$OBJCFLAGS -noixemul" + LDFLAGS="$LDFLAGS -noixemul" + + enable_shared="no" + enable_threads="no" + enable_sockets="no" + enable_files="yes" # Required for reading ENV: + ac_cv_snprintf_useful_ret="yes" + + 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" ;; *-morphos*) @@ -209,10 +261,18 @@ [OBJCFLAGS="$OBJCFLAGS -Wsemicolon-before-method-body"]) AX_CHECK_COMPILER_FLAGS([-Wobjc-missing-property-synthesis -Werror], [OBJCFLAGS="$OBJCFLAGS -Wobjc-missing-property-synthesis"]) AX_CHECK_COMPILER_FLAGS([-Wmissing-method-return-type -Werror], [OBJCFLAGS="$OBJCFLAGS -Wmissing-method-return-type"]) + +case "$host" in + m68k-*-amigaos*) + dnl The inline headers generate code that triggers + dnl -Wpointer-sign. + OBJCFLAGS="$OBJCFLAGS -Wno-pointer-sign" + ;; +esac AC_MSG_CHECKING(whether Objective C compiler supports properties) AC_TRY_COMPILE([ #ifdef __has_attribute # if __has_attribute(objc_root_class) @@ -596,12 +656,15 @@ ], [ AC_MSG_RESULT(no) AC_DEFINE(UINTPTR_MAX, [(~(uintptr_t)0)], [Maximum value for uintptr_t]) ]) +AC_CHECK_HEADER(inttypes.h, + [AC_DEFINE(OF_HAVE_INTTYPES_H, 1, [Whether we have inttypes.h])]) + AC_CHECK_HEADER(sys/types.h, - [AC_DEFINE(OF_HAVE_SYS_TYPES_H, 1, [Whether we have ])]) + [AC_DEFINE(OF_HAVE_SYS_TYPES_H, 1, [Whether we have sys/types.h])]) AC_CHECK_TYPE(max_align_t, [AC_DEFINE(OF_HAVE_MAX_ALIGN_T, 1, [Whether we have max_align_t])]) AC_CHECK_HEADER(stdnoreturn.h, @@ -1302,15 +1365,14 @@ AC_DEFUN([CHECK_BUILTIN_BSWAP], [ AC_MSG_CHECKING(for __builtin_bswap$1) AC_TRY_LINK([ #include #include - #include #include ], [ uint$1_t i = errno; - printf("%" PRIu$1, __builtin_bswap$1(i)); + printf("%d", (int)__builtin_bswap$1(i)); ], [ AC_MSG_RESULT(yes) AC_DEFINE(OF_HAVE_BUILTIN_BSWAP$1, 1, [Whether we have __builtin_bswap$1]) ], [ Index: src/OFApplication.m ================================================================== --- src/OFApplication.m +++ src/OFApplication.m @@ -34,11 +34,11 @@ #import "OFRunLoop.h" #import "OFRunLoop+Private.h" #import "OFThread.h" #import "OFThread+Private.h" #import "OFSandbox.h" -#ifdef OF_MORPHOS +#ifdef OF_AMIGAOS # import "OFFile.h" # import "OFFileManager.h" #endif #import "OFOutOfMemoryException.h" @@ -50,11 +50,14 @@ #elif defined(OF_WINDOWS) # include extern int _CRT_glob; extern void __wgetmainargs(int *, wchar_t ***, wchar_t ***, int, int *); -#elif defined(OF_MORPHOS) +#elif defined(OF_AMIGAOS) +# ifdef OF_AMIGAOS3 +# define INTUITION_CLASSES_H +# endif # include # include #elif !defined(OF_IOS) extern char **environ; #endif @@ -177,10 +180,12 @@ + (void)terminateWithStatus: (int)status { #ifndef OF_PSP exit(status); + + OF_UNREACHABLE #else sceKernelExitGame(); OF_UNREACHABLE #endif @@ -247,11 +252,11 @@ objc_autoreleasePoolPop(pool); } FreeEnvironmentStringsW(env0); -#elif defined(OF_MORPHOS) +#elif defined(OF_AMIGAOS) void *pool = objc_autoreleasePoolPush(); OFFileManager *fileManager = [OFFileManager defaultManager]; OFArray *envContents = [fileManager contentsOfDirectoryAtPath: @"ENV:"]; const of_string_encoding_t encoding = [OFLocalization encoding]; Index: src/OFDate.m ================================================================== --- src/OFDate.m +++ src/OFDate.m @@ -15,11 +15,10 @@ * file. */ #include "config.h" -#include #include #include #include #include Index: src/OFLocalization.m ================================================================== --- src/OFLocalization.m +++ src/OFLocalization.m @@ -33,10 +33,13 @@ # ifdef OF_AMIGAOS4 # define __NOLIBBASE__ # define __NOGLOBALIFACE__ # define __USE_INLINE__ # endif +# ifdef OF_AMIGAOS3 +# define INTUITION_CLASSES_H +# endif # include # include # include #endif Index: src/OFNumber.m ================================================================== --- src/OFNumber.m +++ src/OFNumber.m @@ -15,11 +15,10 @@ * file. */ #include "config.h" -#include #include #import "OFNumber.h" #import "OFString.h" #import "OFXMLElement.h" Index: src/OFObject.m ================================================================== --- src/OFObject.m +++ src/OFObject.m @@ -153,10 +153,12 @@ /* * Just in case doesNotRecognizeSelector: returned, even though it must * never return. */ abort(); + + OF_UNREACHABLE } void OF_NO_RETURN_FUNC of_method_not_found_stret(void *st, id obj, SEL sel) { Index: src/OFString.h ================================================================== --- src/OFString.h +++ src/OFString.h @@ -28,10 +28,13 @@ # include #endif #include #include +#ifdef OF_HAVE_INTTYPES_H +# include +#endif #import "OFObject.h" #import "OFSerialization.h" #import "OFJSONRepresentation.h" #import "OFMessagePackRepresentation.h" Index: src/OFString.m ================================================================== --- src/OFString.m +++ src/OFString.m @@ -66,10 +66,15 @@ * However, the MinGW version __strtod seems to be ok. */ #ifdef __MINGW32__ # define strtod __strtod #endif + +#ifdef OF_AMIGAOS3 +/* libnix has strtod, but not strtof */ +# define strtof strtod +#endif static struct { Class isa; } placeholder; Index: src/OFTarArchiveEntry.m ================================================================== --- src/OFTarArchiveEntry.m +++ src/OFTarArchiveEntry.m @@ -15,16 +15,15 @@ * file. */ #include "config.h" -#include - #import "OFTarArchiveEntry.h" #import "OFTarArchiveEntry+Private.h" -#import "OFStream.h" #import "OFDate.h" +#import "OFStream.h" +#import "OFString.h" #import "OFOutOfRangeException.h" static OFString * stringFromBuffer(const unsigned char *buffer, size_t length) Index: src/OFThread.m ================================================================== --- src/OFThread.m +++ src/OFThread.m @@ -82,10 +82,13 @@ #endif #ifdef OF_DJGPP # define lrint(x) rint(x) #endif +#ifdef OF_AMIGAOS3 +# define lrint(x) ((long)x) +#endif #ifdef OF_HAVE_THREADS # import "threading.h" static of_tlskey_t threadSelfKey; Index: src/OFZIPArchiveEntry.m ================================================================== --- src/OFZIPArchiveEntry.m +++ src/OFZIPArchiveEntry.m @@ -15,18 +15,16 @@ * file. */ #include "config.h" -#include - #import "OFZIPArchiveEntry.h" #import "OFZIPArchiveEntry+Private.h" -#import "OFString.h" #import "OFData.h" #import "OFDate.h" #import "OFStream.h" +#import "OFString.h" #import "OFInvalidArgumentException.h" #import "OFInvalidFormatException.h" #import "OFOutOfRangeException.h" Index: src/exceptions/OFBindFailedException.m ================================================================== --- src/exceptions/OFBindFailedException.m +++ src/exceptions/OFBindFailedException.m @@ -15,12 +15,10 @@ * file. */ #include "config.h" -#include - #import "OFBindFailedException.h" #import "OFString.h" @implementation OFBindFailedException @synthesize host = _host, port = _port, socket = _socket, errNo = _errNo; Index: src/exceptions/OFConnectionFailedException.m ================================================================== --- src/exceptions/OFConnectionFailedException.m +++ src/exceptions/OFConnectionFailedException.m @@ -15,12 +15,10 @@ * file. */ #include "config.h" -#include - #import "OFConnectionFailedException.h" #import "OFString.h" @implementation OFConnectionFailedException @synthesize host = _host, port = _port, socket = _socket, errNo = _errNo; Index: src/objfw-defs.h.in ================================================================== --- src/objfw-defs.h.in +++ src/objfw-defs.h.in @@ -1,6 +1,8 @@ #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 @@ -10,10 +12,11 @@ #undef OF_HAVE_CHMOD #undef OF_HAVE_CHOWN #undef OF_HAVE_FILES #undef OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR #undef OF_HAVE_IPV6 +#undef OF_HAVE_LIMITS_H #undef OF_HAVE_LINK #undef OF_HAVE_MAX_ALIGN_T #undef OF_HAVE_NETINET_IN_H #undef OF_HAVE_OSATOMIC #undef OF_HAVE_OSATOMIC_64 @@ -36,7 +39,32 @@ #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 Index: src/platform.h ================================================================== --- src/platform.h +++ src/platform.h @@ -106,10 +106,13 @@ # else # define OF_MORPHOS_IXEMUL # endif #elif defined(__amigaos4__) # define OF_AMIGAOS4 +# define OF_AMIGAOS +#elif defined(__amigaos__) +# define OF_AMIGAOS3 # define OF_AMIGAOS #elif defined(__sun__) # define OF_SOLARIS #elif defined(__QNX__) # define OF_QNX Index: src/resolver.m ================================================================== --- src/resolver.m +++ src/resolver.m @@ -20,14 +20,14 @@ #define _WIN32_WINNT 0x0501 #include #include #include -#include + +#import "OFString.h" #import "resolver.h" - #import "macros.h" #if !defined(HAVE_THREADSAFE_GETADDRINFO) && defined(OF_HAVE_THREADS) # include "threading.h" #endif Index: src/runtime/ObjFW_RT.h ================================================================== --- src/runtime/ObjFW_RT.h +++ src/runtime/ObjFW_RT.h @@ -26,10 +26,12 @@ #endif #include #include #include + +#import "platform.h" #ifndef __has_feature # define __has_feature(x) 0 #endif Index: src/runtime/private.h ================================================================== --- src/runtime/private.h +++ src/runtime/private.h @@ -15,11 +15,12 @@ * file. */ #include "config.h" -#include "platform.h" +#import "macros.h" +#import "platform.h" #if !defined(__has_feature) || !__has_feature(nullability) # ifndef _Nonnull # define _Nonnull # endif @@ -222,6 +223,7 @@ { \ fprintf(stderr, "[objc @ " __FILE__ ":%d] ", __LINE__); \ fprintf(stderr, __VA_ARGS__); \ fputs("\n", stderr); \ abort(); \ + OF_UNREACHABLE \ } Index: tests/ForwardingTests.m ================================================================== --- tests/ForwardingTests.m +++ tests/ForwardingTests.m @@ -121,10 +121,12 @@ if (sel_isEqual(selector, @selector(forwardingTargetSelfTest)) || sel_isEqual(selector, @selector(forwardingTargetSelfStRetTest))) return self; abort(); + + OF_UNREACHABLE } @end @implementation ForwardingTarget - (uint32_t)forwardingTargetTest: (intptr_t)a0 Index: utils/ofzip/TarArchive.m ================================================================== --- utils/ofzip/TarArchive.m +++ utils/ofzip/TarArchive.m @@ -15,19 +15,18 @@ * file. */ #include "config.h" -#include - #import "OFApplication.h" #import "OFDate.h" #import "OFFileManager.h" #import "OFLocalization.h" #import "OFNumber.h" #import "OFSet.h" #import "OFStdIOStream.h" +#import "OFString.h" #import "TarArchive.h" #import "OFZIP.h" static OFZIP *app; Index: utils/ofzip/ZIPArchive.m ================================================================== --- utils/ofzip/ZIPArchive.m +++ utils/ofzip/ZIPArchive.m @@ -15,20 +15,20 @@ * file. */ #include "config.h" -#include #include #import "OFApplication.h" #import "OFDate.h" #import "OFFileManager.h" #import "OFLocalization.h" #import "OFNumber.h" #import "OFSet.h" #import "OFStdIOStream.h" +#import "OFString.h" #import "ZIPArchive.h" #import "OFZIP.h" #import "OFInvalidFormatException.h"