Index: .github/workflows/msys2.yml ================================================================== --- .github/workflows/msys2.yml +++ .github/workflows/msys2.yml @@ -34,5 +34,10 @@ shell: msys2 {0} run: make check - name: make install shell: msys2 {0} run: make install + - name: C++ test + shell: msys2 {0} + run: | + objfw-compile -o cxxtest .github/workflows/CXXTest.mm + ./cxxtest.exe Index: .github/workflows/nintendo-ds.yml ================================================================== --- .github/workflows/nintendo-ds.yml +++ .github/workflows/nintendo-ds.yml @@ -13,23 +13,23 @@ run: | docker run \ -e DEVKITPRO=/opt/devkitpro \ -e PATH="/opt/devkitpro/devkitARM/bin:$PATH" \ -v "$PWD:/objfw" \ - devkitpro/devkitarm \ + devkitpro/devkitarm:20241104 \ sh -c 'cd /objfw && ./configure --host=arm-none-eabi --with-nds' - name: make run: | docker run \ -e DEVKITPRO=/opt/devkitpro \ -e PATH="/opt/devkitpro/devkitARM/bin:$PATH" \ -v "$PWD:/objfw" \ - devkitpro/devkitarm \ + devkitpro/devkitarm:20241104 \ sh -c "cd /objfw && make -j$(nproc)" - name: make install run: | docker run \ -e DEVKITPRO=/opt/devkitpro \ -e PATH="/opt/devkitpro/devkitARM/bin:$PATH" \ -v "$PWD:/objfw" \ - devkitpro/devkitarm \ + devkitpro/devkitarm:20241104 \ sh -c "cd /objfw && make install" Index: ChangeLog ================================================================== --- ChangeLog +++ ChangeLog @@ -2,10 +2,16 @@ * Changes of existing features or bugfixes + New features This file only contains the most significant changes. +ObjFW 1.2 -> ObjFW 1.2.1, 2024-11-09 + * Fixes exceptions in ObjC++. + * Fixes compiling ObjC++ on Windows. + * Fixes compiling tests on Haiku. + * Properly hides private methods in ObjFWHID. + ObjFW 1.1.7 -> ObjFW 1.2, 2024-11-02 + Adds a new framework for game controllers called ObjFWHID. + Adds support for tagged pointer strings. + Strings are now allowed to contain `\0`, while preventing such strings from being passed to anything that expects a C string. Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -1,14 +1,13 @@ -AC_INIT(ObjFW, 1.3-dev, js@nil.im, objfw, https://objfw.nil.im/) +AC_INIT(ObjFW, 1.2.1, js@nil.im, objfw, https://objfw.nil.im/) AC_CONFIG_SRCDIR(src) AC_CONFIG_AUX_DIR(build-aux) AC_CONFIG_MACRO_DIR(build-aux/m4) AC_DEFINE(OBJFW_VERSION_MAJOR, 1, [The major version of ObjFW]) -AC_DEFINE(OBJFW_VERSION_MINOR, 3, [The minor version of ObjFW]) -dnl This may only be set to 1.3 once 1.3 is released -AC_SUBST(BUNDLE_VERSION, 1.2.0) +AC_DEFINE(OBJFW_VERSION_MINOR, 2, [The minor version of ObjFW]) +AC_SUBST(BUNDLE_VERSION, 1.2.1) AC_SUBST(BUNDLE_SHORT_VERSION, 1.2) for i in configure.ac build-aux/m4/*; do AS_IF([test $i -nt configure], [ AC_MSG_ERROR([$i is newer than configure! Run ./autogen.sh!]) @@ -2119,11 +2118,11 @@ AS_IF([test x"$GOBJC" = x"yes"], [ OBJCFLAGS="$OBJCFLAGS -Wwrite-strings -Wpointer-arith" AC_ARG_ENABLE(werror, AS_HELP_STRING([--disable-werror], [do not build with -Werror])) - AS_IF([test x"$enable_werror" != x"no"], [ + AS_IF([test x"$enable_werror" = x"yes"], [ OBJCFLAGS="$OBJCFLAGS -Werror" ]) old_OBJCFLAGS="$OBJCFLAGS" OBJCFLAGS="$OBJCFLAGS -Werror" Index: extra.mk.in ================================================================== --- extra.mk.in +++ extra.mk.in @@ -1,19 +1,19 @@ OBJFW_SHARED_LIB = @OBJFW_SHARED_LIB@ OBJFW_STATIC_LIB = @OBJFW_STATIC_LIB@ OBJFW_FRAMEWORK = @OBJFW_FRAMEWORK@ OBJFW_LIB_MAJOR = 1 OBJFW_LIB_MINOR = 2 -OBJFW_LIB_PATCH = 0 +OBJFW_LIB_PATCH = 1 OBJFW_LIB_MAJOR_MINOR = ${OBJFW_LIB_MAJOR}.${OBJFW_LIB_MINOR} OBJFWRT_SHARED_LIB = @OBJFWRT_SHARED_LIB@ OBJFWRT_STATIC_LIB = @OBJFWRT_STATIC_LIB@ OBJFWRT_FRAMEWORK = @OBJFWRT_FRAMEWORK@ OBJFWRT_LIB_MAJOR = 1 OBJFWRT_LIB_MINOR = 2 -OBJFWRT_LIB_PATCH = 0 +OBJFWRT_LIB_PATCH = 1 OBJFWRT_LIB_MAJOR_MINOR = ${OBJFWRT_LIB_MAJOR}.${OBJFWRT_LIB_MINOR} OBJFWBRIDGE_SHARED_LIB = @OBJFWBRIDGE_SHARED_LIB@ OBJFWBRIDGE_STATIC_LIB = @OBJFWBRIDGE_STATIC_LIB@ OBJFWBRIDGE_FRAMEWORK = @OBJFWBRIDGE_FRAMEWORK@ @@ -31,11 +31,11 @@ OBJFWHID_SHARED_LIB = @OBJFWHID_SHARED_LIB@ OBJFWHID_STATIC_LIB = @OBJFWHID_STATIC_LIB@ OBJFWHID_FRAMEWORK = @OBJFWHID_FRAMEWORK@ OBJFWHID_LIB_MAJOR = 1 OBJFWHID_LIB_MINOR = 0 -OBJFWHID_LIB_PATCH = 0 +OBJFWHID_LIB_PATCH = 1 OBJFWHID_LIB_MAJOR_MINOR = ${OBJFWHID_LIB_MAJOR}.${OBJFWHID_LIB_MINOR} BIN_PREFIX = @BIN_PREFIX@ BRIDGE = @BRIDGE@ CVINCLUDE_INLINE_H = @CVINCLUDE_INLINE_H@ Index: src/OFColor.h ================================================================== --- src/OFColor.h +++ src/OFColor.h @@ -30,11 +30,11 @@ #ifdef OF_HAVE_CLASS_PROPERTIES @property (class, readonly, nonatomic) OFColor *black; @property (class, readonly, nonatomic) OFColor *silver; @property (class, readonly, nonatomic) OFColor *gray; @property (class, readonly, nonatomic) OFColor *grey - OF_DEPRECATED(ObjFW, 1, 1, "Use gray instead"); + OF_DEPRECATED(ObjFW, 1, 1, "Use +[gray] instead"); @property (class, readonly, nonatomic) OFColor *white; @property (class, readonly, nonatomic) OFColor *maroon; @property (class, readonly, nonatomic) OFColor *red; @property (class, readonly, nonatomic) OFColor *purple; @property (class, readonly, nonatomic) OFColor *fuchsia; @@ -97,11 +97,11 @@ * * The RGBA value is (0.5, 0.5, 0.5, 1). * * @return The HTML color `gray` */ -+ (OFColor *)grey OF_DEPRECATED(ObjFW, 1, 1, "Use gray instead"); ++ (OFColor *)grey OF_DEPRECATED(ObjFW, 1, 1, "Use +[gray] instead"); /** * @brief Returns the HTML color `white`. * * The RGBA value is (1, 1, 1, 1). Index: src/OFFileIRIHandler.m ================================================================== --- src/OFFileIRIHandler.m +++ src/OFFileIRIHandler.m @@ -41,10 +41,11 @@ #endif #if defined(OF_FREEBSD) || defined(OF_NETBSD) # include #endif #ifdef OF_HAIKU +# include # include #endif #ifdef OF_DJGPP # include #endif Index: src/hid/OHDualSenseGamepad+Private.h ================================================================== --- src/hid/OHDualSenseGamepad+Private.h +++ src/hid/OHDualSenseGamepad+Private.h @@ -27,9 +27,9 @@ @interface OHDualSenseGamepad () #if defined(OF_LINUX) && defined(OF_HAVE_FILES) #endif -- (instancetype)oh_init OF_METHOD_FAMILY(init) OF_DESIGNATED_INITIALIZER; +- (instancetype)oh_init OF_METHOD_FAMILY(init); @end OF_ASSUME_NONNULL_END Index: src/hid/OHDualShock4Gamepad+Private.h ================================================================== --- src/hid/OHDualShock4Gamepad+Private.h +++ src/hid/OHDualShock4Gamepad+Private.h @@ -27,9 +27,9 @@ @interface OHDualShock4Gamepad () #if defined(OF_LINUX) && defined(OF_HAVE_FILES) #endif -- (instancetype)oh_init OF_METHOD_FAMILY(init) OF_DESIGNATED_INITIALIZER; +- (instancetype)oh_init OF_METHOD_FAMILY(init); @end OF_ASSUME_NONNULL_END Index: src/hid/OHEmulatedGameControllerAxis.h ================================================================== --- src/hid/OHEmulatedGameControllerAxis.h +++ src/hid/OHEmulatedGameControllerAxis.h @@ -32,9 +32,9 @@ - (instancetype)oh_initWithName: (OFString *)name analog: (bool)analog OF_UNAVAILABLE; - (instancetype) oh_initWithNegativeButton: (OHGameControllerButton *)negativeButton positiveButton: (OHGameControllerButton *)positiveButton - OF_METHOD_FAMILY(init) OF_DESIGNATED_INITIALIZER; + OF_METHOD_FAMILY(init); @end OF_ASSUME_NONNULL_END Index: src/hid/OHEmulatedGameControllerButton.h ================================================================== --- src/hid/OHEmulatedGameControllerButton.h +++ src/hid/OHEmulatedGameControllerButton.h @@ -31,10 +31,9 @@ } - (instancetype)oh_initWithName: (OFString *)name analog: (bool)analog OF_UNAVAILABLE; - (instancetype)oh_initWithAxis: (OHGameControllerAxis *)axis - positive: (bool)positive - OF_METHOD_FAMILY(init) OF_DESIGNATED_INITIALIZER; + positive: (bool)positive OF_METHOD_FAMILY(init); @end OF_ASSUME_NONNULL_END Index: src/hid/OHEmulatedGameControllerTriggerButton.h ================================================================== --- src/hid/OHEmulatedGameControllerTriggerButton.h +++ src/hid/OHEmulatedGameControllerTriggerButton.h @@ -37,9 +37,9 @@ axis: (OHGameControllerAxis *)axis; - (instancetype)oh_initWithName: (OFString *)name analog: (bool)analog OF_UNAVAILABLE; - (instancetype)oh_initWithName: (OFString *)name axis: (OHGameControllerAxis *)axis - OF_METHOD_FAMILY(init) OF_DESIGNATED_INITIALIZER; + OF_METHOD_FAMILY(init); @end OF_ASSUME_NONNULL_END Index: src/hid/OHEvdevGameController.h ================================================================== --- src/hid/OHEvdevGameController.h +++ src/hid/OHEvdevGameController.h @@ -37,12 +37,11 @@ OFString *_name; id _profile; } - (instancetype)oh_init OF_UNAVAILABLE; -- (instancetype)oh_initWithPath: (OFString *)path - OF_METHOD_FAMILY(init) OF_DESIGNATED_INITIALIZER; +- (instancetype)oh_initWithPath: (OFString *)path OF_METHOD_FAMILY(init); - (void)oh_pollState; @end extern const uint16_t OHEvdevButtonIDs[]; extern const size_t OHNumEvdevButtonIDs; Index: src/hid/OHEvdevGameControllerProfile.h ================================================================== --- src/hid/OHEvdevGameControllerProfile.h +++ src/hid/OHEvdevGameControllerProfile.h @@ -35,10 +35,9 @@ - (instancetype)oh_initWithKeyBits: (unsigned long *)keyBits evBits: (unsigned long *)evBits absBits: (unsigned long *)absBits vendorID: (uint16_t)vendorID - productID: (uint16_t)productID - OF_METHOD_FAMILY(init) OF_DESIGNATED_INITIALIZER; + productID: (uint16_t)productID OF_METHOD_FAMILY(init); @end OF_ASSUME_NONNULL_END Index: src/hid/OHGameController+Private.h ================================================================== --- src/hid/OHGameController+Private.h +++ src/hid/OHGameController+Private.h @@ -20,9 +20,9 @@ #import "OHGameController.h" OF_ASSUME_NONNULL_BEGIN @interface OHGameController () -- (instancetype)oh_init OF_METHOD_FAMILY(init) OF_DESIGNATED_INITIALIZER; +- (instancetype)oh_init OF_METHOD_FAMILY(init); @end OF_ASSUME_NONNULL_END Index: src/hid/OHGameControllerElement+Private.h ================================================================== --- src/hid/OHGameControllerElement+Private.h +++ src/hid/OHGameControllerElement+Private.h @@ -22,10 +22,9 @@ OF_ASSUME_NONNULL_BEGIN @interface OHGameControllerElement () + (instancetype)oh_elementWithName: (OFString *)name analog: (bool)analog; - (instancetype)oh_initWithName: (OFString *)name - analog: (bool)analog - OF_METHOD_FAMILY(init) OF_DESIGNATED_INITIALIZER; + analog: (bool)analog OF_METHOD_FAMILY(init); @end OF_ASSUME_NONNULL_END Index: src/hid/OHJoyConPair.h ================================================================== --- src/hid/OHJoyConPair.h +++ src/hid/OHJoyConPair.h @@ -61,10 +61,9 @@ * @param leftJoyCon The left Joy-Con for the pair * @param rightJoyCon The right Joy-Con for the pair * @return An initialized Joy-Con pair */ - (instancetype)initWithLeftJoyCon: (OHLeftJoyCon *)leftJoyCon - rightJoyCon: (OHRightJoyCon *)rightJoyCon - OF_DESIGNATED_INITIALIZER; + rightJoyCon: (OHRightJoyCon *)rightJoyCon; @end OF_ASSUME_NONNULL_END Index: src/hid/OHLeftJoyCon+Private.h ================================================================== --- src/hid/OHLeftJoyCon+Private.h +++ src/hid/OHLeftJoyCon+Private.h @@ -27,9 +27,9 @@ @interface OHLeftJoyCon () #if defined(OF_LINUX) && defined(OF_HAVE_FILES) #endif -- (instancetype)oh_init OF_METHOD_FAMILY(init) OF_DESIGNATED_INITIALIZER; +- (instancetype)oh_init OF_METHOD_FAMILY(init); @end OF_ASSUME_NONNULL_END Index: src/hid/OHN64Controller+Private.h ================================================================== --- src/hid/OHN64Controller+Private.h +++ src/hid/OHN64Controller+Private.h @@ -27,9 +27,9 @@ @interface OHN64Controller () #if defined(OF_LINUX) && defined(OF_HAVE_FILES) #endif -- (instancetype)oh_init OF_METHOD_FAMILY(init) OF_DESIGNATED_INITIALIZER; +- (instancetype)oh_init OF_METHOD_FAMILY(init); @end OF_ASSUME_NONNULL_END Index: src/hid/OHNintendo3DSExtendedGamepad+Private.h ================================================================== --- src/hid/OHNintendo3DSExtendedGamepad+Private.h +++ src/hid/OHNintendo3DSExtendedGamepad+Private.h @@ -20,9 +20,9 @@ #import "OHNintendo3DSExtendedGamepad.h" OF_ASSUME_NONNULL_BEGIN @interface OHNintendo3DSExtendedGamepad () -- (instancetype)oh_init OF_METHOD_FAMILY(init) OF_DESIGNATED_INITIALIZER; +- (instancetype)oh_init OF_METHOD_FAMILY(init); @end OF_ASSUME_NONNULL_END Index: src/hid/OHNintendoDSGamepad+Private.h ================================================================== --- src/hid/OHNintendoDSGamepad+Private.h +++ src/hid/OHNintendoDSGamepad+Private.h @@ -20,9 +20,9 @@ #import "OHNintendoDSGamepad.h" OF_ASSUME_NONNULL_BEGIN @interface OHNintendoDSGamepad () -- (instancetype)oh_init OF_METHOD_FAMILY(init) OF_DESIGNATED_INITIALIZER; +- (instancetype)oh_init OF_METHOD_FAMILY(init); @end OF_ASSUME_NONNULL_END Index: src/hid/OHNintendoSwitchExtendedGamepad+Private.h ================================================================== --- src/hid/OHNintendoSwitchExtendedGamepad+Private.h +++ src/hid/OHNintendoSwitchExtendedGamepad+Private.h @@ -20,9 +20,9 @@ #import "OHNintendoSwitchExtendedGamepad.h" OF_ASSUME_NONNULL_BEGIN @interface OHNintendoSwitchExtendedGamepad () -- (instancetype)oh_init OF_METHOD_FAMILY(init) OF_DESIGNATED_INITIALIZER; +- (instancetype)oh_init OF_METHOD_FAMILY(init); @end OF_ASSUME_NONNULL_END Index: src/hid/OHNintendoSwitchGameController.h ================================================================== --- src/hid/OHNintendoSwitchGameController.h +++ src/hid/OHNintendoSwitchGameController.h @@ -32,10 +32,9 @@ PadState _pad; OHNintendoSwitchExtendedGamepad *_extendedGamepad; } - (instancetype)oh_init OF_UNAVAILABLE; -- (instancetype)oh_initWithIndex: (size_t)index - OF_METHOD_FAMILY(init) OF_DESIGNATED_INITIALIZER; +- (instancetype)oh_initWithIndex: (size_t)index OF_METHOD_FAMILY(init); @end OF_ASSUME_NONNULL_END Index: src/hid/OHRightJoyCon+Private.h ================================================================== --- src/hid/OHRightJoyCon+Private.h +++ src/hid/OHRightJoyCon+Private.h @@ -27,9 +27,9 @@ @interface OHRightJoyCon () #if defined(OF_LINUX) && defined(OF_HAVE_FILES) #endif -- (instancetype)oh_init OF_METHOD_FAMILY(init) OF_DESIGNATED_INITIALIZER; +- (instancetype)oh_init OF_METHOD_FAMILY(init); @end OF_ASSUME_NONNULL_END Index: src/hid/OHStadiaGamepad+Private.h ================================================================== --- src/hid/OHStadiaGamepad+Private.h +++ src/hid/OHStadiaGamepad+Private.h @@ -27,9 +27,9 @@ @interface OHStadiaGamepad () #if defined(OF_LINUX) && defined(OF_HAVE_FILES) #endif -- (instancetype)oh_init OF_METHOD_FAMILY(init) OF_DESIGNATED_INITIALIZER; +- (instancetype)oh_init OF_METHOD_FAMILY(init); @end OF_ASSUME_NONNULL_END Index: src/hid/OHWiiClassicController+Private.h ================================================================== --- src/hid/OHWiiClassicController+Private.h +++ src/hid/OHWiiClassicController+Private.h @@ -20,9 +20,9 @@ #import "OHWiiClassicController.h" OF_ASSUME_NONNULL_BEGIN @interface OHWiiClassicController () -- (instancetype)oh_init OF_METHOD_FAMILY(init) OF_DESIGNATED_INITIALIZER; +- (instancetype)oh_init OF_METHOD_FAMILY(init); @end OF_ASSUME_NONNULL_END Index: src/hid/OHWiiGameController.h ================================================================== --- src/hid/OHWiiGameController.h +++ src/hid/OHWiiGameController.h @@ -28,10 +28,9 @@ id _profile; } - (instancetype)oh_init OF_UNAVAILABLE; - (instancetype)oh_initWithIndex: (int32_t)index - type: (uint32_t)type - OF_METHOD_FAMILY(init) OF_DESIGNATED_INITIALIZER; + type: (uint32_t)type OF_METHOD_FAMILY(init); @end OF_ASSUME_NONNULL_END Index: src/hid/OHWiimote+Private.h ================================================================== --- src/hid/OHWiimote+Private.h +++ src/hid/OHWiimote+Private.h @@ -20,9 +20,9 @@ #import "OHWiimote.h" OF_ASSUME_NONNULL_BEGIN @interface OHWiimote () -- (instancetype)oh_init OF_METHOD_FAMILY(init) OF_DESIGNATED_INITIALIZER; +- (instancetype)oh_init OF_METHOD_FAMILY(init); @end OF_ASSUME_NONNULL_END Index: src/hid/OHXInputGameController.h ================================================================== --- src/hid/OHXInputGameController.h +++ src/hid/OHXInputGameController.h @@ -31,10 +31,9 @@ OFNumber *_Nullable _vendorID, *_Nullable _productID; OHXboxGamepad *_extendedGamepad; } - (instancetype)oh_init OF_UNAVAILABLE; -- (instancetype)oh_initWithIndex: (DWORD)index - OF_METHOD_FAMILY(init) OF_DESIGNATED_INITIALIZER; +- (instancetype)oh_initWithIndex: (DWORD)index OF_METHOD_FAMILY(init); @end OF_ASSUME_NONNULL_END Index: src/hid/OHXboxGamepad+Private.h ================================================================== --- src/hid/OHXboxGamepad+Private.h +++ src/hid/OHXboxGamepad+Private.h @@ -21,9 +21,9 @@ OF_ASSUME_NONNULL_BEGIN @interface OHXboxGamepad () - (instancetype)oh_initWithHasGuideButton: (bool)hasGuideButton - OF_METHOD_FAMILY(init) OF_DESIGNATED_INITIALIZER; + OF_METHOD_FAMILY(init); @end OF_ASSUME_NONNULL_END Index: src/runtime/exception.m ================================================================== --- src/runtime/exception.m +++ src/runtime/exception.m @@ -37,10 +37,11 @@ # include #endif #if defined(__SEH__) # define PERSONALITY gnu_objc_personality +# define CXX_PERSONALITY_STR "__gxx_personality_seh0" #elif defined(__USING_SJLJ_EXCEPTIONS__) # define PERSONALITY __gnu_objc_personality_sj0 # define CXX_PERSONALITY_STR "__gxx_personality_sj0" # define _Unwind_RaiseException _Unwind_SjLj_RaiseException # define __builtin_eh_return_data_regno(i) (i) @@ -235,11 +236,38 @@ uintptr_t thumb = _Unwind_GetGR(ctx, 15) & 1; _Unwind_SetGR(ctx, 15, (value | thumb)); } #endif -#if defined(CXX_PERSONALITY_STR) && !defined(OF_AMIGAOS_M68K) +#if defined(OF_WINDOWS) +# ifdef __SEH__ +static EXCEPTION_DISPOSITION (*cxx_personality)(PEXCEPTION_RECORD, void *, + PCONTEXT, PDISPATCHER_CONTEXT); +# else +static PERSONALITY_FUNC((*cxx_personality)); +# endif + +OF_CONSTRUCTOR() +{ + /* + * This only works if the application uses libc++.dll or + * libstdc++-6.dll. There is unfortunately no other way, as Windows + * does not support proper weak linking. + */ + + HMODULE module; + + module = GetModuleHandle("libc++"); + + if (module == NULL) + module = GetModuleHandle("libstdc++-6"); + + if (module != NULL) + cxx_personality = (__typeof__(cxx_personality)) + GetProcAddress(module, CXX_PERSONALITY_STR); +} +#elif !defined(OF_AMIGAOS_M68K) static PERSONALITY_FUNC(cxx_personality) OF_WEAK_REF(CXX_PERSONALITY_STR); #endif #ifdef __SEH__ extern EXCEPTION_DISPOSITION _GCC_specific_handler(PEXCEPTION_RECORD, void *, @@ -613,11 +641,11 @@ uint8_t found = 0; intptr_t filter = 0; if (foreign) { switch (exClass) { -#if defined(CXX_PERSONALITY_STR) && !defined(OF_AMIGAOS_M68K) +#if !defined(__SEH__) && !defined(OF_AMIGAOS_M68K) case GNUCCXX0_EXCEPTION_CLASS: case CLNGCXX0_EXCEPTION_CLASS: if (cxx_personality != NULL) return CALL_PERSONALITY(cxx_personality); break; @@ -783,30 +811,10 @@ return old; } #ifdef __SEH__ -typedef EXCEPTION_DISPOSITION (*seh_personality_fn)(PEXCEPTION_RECORD, void *, - PCONTEXT, PDISPATCHER_CONTEXT); -static seh_personality_fn __gxx_personality_seh0; - -OF_CONSTRUCTOR() -{ - /* - * This only works if the application uses libstdc++-6.dll. - * There is unfortunately no other way, as Windows does not support - * proper weak linking. - */ - - HMODULE module; - if ((module = GetModuleHandle("libstdc++-6")) == NULL) - return; - - __gxx_personality_seh0 = (seh_personality_fn) - GetProcAddress(module, "__gxx_personality_seh0"); -} - EXCEPTION_DISPOSITION __gnu_objc_personality_seh0(PEXCEPTION_RECORD ms_exc, void *this_frame, PCONTEXT ms_orig_context, PDISPATCHER_CONTEXT ms_disp) { struct _Unwind_Exception *ex = @@ -813,14 +821,14 @@ (struct _Unwind_Exception *)ms_exc->ExceptionInformation[0]; switch (ex->class) { case GNUCCXX0_EXCEPTION_CLASS: case CLNGCXX0_EXCEPTION_CLASS: - if (__gxx_personality_seh0 != NULL) - return __gxx_personality_seh0(ms_exc, this_frame, + if (cxx_personality != NULL) + return cxx_personality(ms_exc, this_frame, ms_orig_context, ms_disp); } return _GCC_specific_handler(ms_exc, this_frame, ms_orig_context, ms_disp, PERSONALITY); } #endif Index: src/tls/ObjFWTLS.h ================================================================== --- src/tls/ObjFWTLS.h +++ src/tls/ObjFWTLS.h @@ -15,11 +15,19 @@ * You should have received a copy of the GNU Lesser General Public License * version 3.0 along with this program. If not, see * . */ -#import "macros.h" +#ifdef OBJFWTLS_LOCAL_INCLUDES +# import "macros.h" +#else +# if defined(__has_feature) && __has_feature(modules) +@import ObjFW; +# else +# import +# endif +#endif #ifdef __cplusplus extern "C" { #endif extern int _ObjFWTLS_reference; Index: tests/OFFileManagerTests.m ================================================================== --- tests/OFFileManagerTests.m +++ tests/OFFileManagerTests.m @@ -21,10 +21,14 @@ #include #import "ObjFW.h" #import "ObjFWTest.h" + +#ifdef OF_HAIKU +# include +#endif @interface OFFileManagerTests: OTTestCase { OFFileManager *_fileManager; OFIRI *_testsDirectoryIRI, *_testFileIRI; Index: utils/ofarc/Makefile ================================================================== --- utils/ofarc/Makefile +++ utils/ofarc/Makefile @@ -18,11 +18,13 @@ ${PROG}: ${LIBOBJFW_DEP_LVL2} ${LIBOBJFWRT_DEP_LVL2} CPPFLAGS += -I../../src \ -I../../src/runtime \ -I../../src/exceptions \ + -I../../src/tls \ -I../.. \ + -DOBJFWTLS_LOCAL_INCLUDES \ -DLOCALIZATION_DIR=\"${datadir}/ofarc/localization\" LIBS := -L../../src -L../../src/tls ${OFHTTP_LIBS} -lobjfw \ -L../../src/runtime ${RUNTIME_LIBS} \ ${LIBS} LD = ${OBJC} Index: utils/ofarc/OFArc.m ================================================================== --- utils/ofarc/OFArc.m +++ utils/ofarc/OFArc.m @@ -36,10 +36,14 @@ #import "GZIPArchive.h" #import "LHAArchive.h" #import "TarArchive.h" #import "ZIPArchive.h" #import "ZooArchive.h" + +#ifdef HAVE_TLS_SUPPORT +# import "ObjFWTLS.h" +#endif #import "OFCreateDirectoryFailedException.h" #import "OFGetItemAttributesFailedException.h" #import "OFInvalidArgumentException.h" #import "OFInvalidFormatException.h" @@ -48,10 +52,18 @@ #import "OFReadFailedException.h" #import "OFSeekFailedException.h" #import "OFWriteFailedException.h" #define bufferSize 4096 + +#ifdef HAVE_TLS_SUPPORT +void +_reference_to_ObjFWTLS(void) +{ + _ObjFWTLS_reference = 1; +} +#endif OF_APPLICATION_DELEGATE(OFArc) static void help(OFStream *stream, bool full, int status) Index: utils/ofhash/Makefile ================================================================== --- utils/ofhash/Makefile +++ utils/ofhash/Makefile @@ -13,11 +13,13 @@ ${PROG}: ${LIBOBJFW_DEP_LVL2} ${LIBOBJFWRT_DEP_LVL2} CPPFLAGS += -I../../src \ -I../../src/runtime \ -I../../src/exceptions \ + -I../../src/tls \ -I../.. \ + -DOBJFWTLS_LOCAL_INCLUDES \ -DLOCALIZATION_DIR=\"${datadir}/ofhash/localization\" LIBS := -L../../src -L../../src/tls ${OFHASH_LIBS} -lobjfw \ -L../../src/runtime ${RUNTIME_LIBS} \ ${LIBS} LD = ${OBJC} Index: utils/ofhash/OFHash.m ================================================================== --- utils/ofhash/OFHash.m +++ utils/ofhash/OFHash.m @@ -34,16 +34,28 @@ #import "OFSHA384Hash.h" #import "OFSHA512Hash.h" #import "OFSandbox.h" #import "OFSecureData.h" #import "OFStdIOStream.h" + +#ifdef HAVE_TLS_SUPPORT +# import "ObjFWTLS.h" +#endif #import "OFOpenItemFailedException.h" #import "OFReadFailedException.h" @interface OFHash: OFObject @end + +#ifdef HAVE_TLS_SUPPORT +void +_reference_to_ObjFWTLS(void) +{ + _ObjFWTLS_reference = 1; +} +#endif OF_APPLICATION_DELEGATE(OFHash) static void help(void) Index: utils/ofhttp/Makefile ================================================================== --- utils/ofhttp/Makefile +++ utils/ofhttp/Makefile @@ -16,10 +16,11 @@ CPPFLAGS += -I../../src \ -I../../src/runtime \ -I../../src/exceptions \ -I../../src/tls \ -I../.. \ + -DOBJFWTLS_LOCAL_INCLUDES \ -DLOCALIZATION_DIR='"${datadir}/ofhttp/localization"' LIBS := -L../../src -L../../src/tls ${OFHTTP_LIBS} -lobjfw \ -L../../src/runtime ${RUNTIME_LIBS} \ ${LIBS} LD = ${OBJC}