From f5e8dadb8da6cd91435e75792288800949d8282b Mon Sep 17 00:00:00 2001 From: Ronald Oussoren Date: Fri, 11 Mar 2022 13:48:01 +0100 Subject: [PATCH] Testing for #456 found some metadata that cannot be parsed by the bridge * Add constants for the 'A' and 'j' characters in type encoding * Basic implementation for 'A' in objc_support The implemtation is not entirely correct, the prefix denotes an atomic varialble and should be read/written using atomic instructions. The prefix is currently ignored, that should be good enough for now. The 'j' prefix is not supported by the bridge, and is not used in public APIs. --- pyobjc-core/Modules/objc/objc-runtime-compat.h | 6 ++++++ pyobjc-core/Modules/objc/objc_support.m | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pyobjc-core/Modules/objc/objc-runtime-compat.h b/pyobjc-core/Modules/objc/objc-runtime-compat.h index 96f67793be..9a324901f0 100644 --- a/pyobjc-core/Modules/objc/objc-runtime-compat.h +++ b/pyobjc-core/Modules/objc/objc-runtime-compat.h @@ -29,6 +29,12 @@ struct PyObjC_method { #define _C_BYCOPY 'O' #define _C_BYREF 'R' +/* From the clang sources... + * Both are a prefix for a basic type + */ +#define _C_ATOMIC 'A' +#define _C_COMPLEX 'j' /* XXX: Requires more work to support */ + /* These don't actually exist in the Objective-C runtime, but are used * by the bridge to simplify code. */ diff --git a/pyobjc-core/Modules/objc/objc_support.m b/pyobjc-core/Modules/objc/objc_support.m index 2f87a4bfae..b02366ef2e 100644 --- a/pyobjc-core/Modules/objc/objc_support.m +++ b/pyobjc-core/Modules/objc/objc_support.m @@ -328,7 +328,7 @@ - (PyObject* _Nullable)__pyobjc_PythonTransient__:(int*)cookie { while (*type == _C_CONST || *type == _C_IN || *type == _C_INOUT || *type == _C_OUT || *type == _C_BYCOPY || *type == _C_BYREF || *type == _C_ONEWAY - || *type == 'O') { + || *type == 'O' || *type == _C_ATOMIC) { type++; } while (*type && isdigit(*type)) { // LCOV_BR_EXCL_LINE