Expose _protected in util.h, useful elsewhere

This commit is contained in:
K. Lange 2022-08-11 10:47:46 +09:00
parent ca981fbb8e
commit db3a628c04
2 changed files with 10 additions and 10 deletions

View File

@ -17,6 +17,16 @@
#define likely(cond) __builtin_expect((cond), 1) #define likely(cond) __builtin_expect((cond), 1)
#define unlikely(cond) __builtin_expect((cond), 0) #define unlikely(cond) __builtin_expect((cond), 0)
#if !defined(__has_attribute)
# define __has_attribute(attr) 0
#endif
#if __has_attribute(protected)
# define _protected __attribute__((protected))
#else
# define _protected
#endif
#if !defined(_WIN32) && !defined(EFI_PLATFORM) #if !defined(_WIN32) && !defined(EFI_PLATFORM)
#define _noexport __attribute__((visibility("hidden"))) #define _noexport __attribute__((visibility("hidden")))
#else #else

View File

@ -1062,16 +1062,6 @@ const char * krk_typeName(KrkValue value) {
return krk_getType(value)->name->chars; return krk_getType(value)->name->chars;
} }
#if !defined(__has_attribute)
# define __has_attribute(attr) 0
#endif
#if __has_attribute(protected)
# define _protected __attribute__((protected))
#else
# define _protected
#endif
static int _try_op(size_t methodOffset, KrkValue a, KrkValue b, KrkValue *out) { static int _try_op(size_t methodOffset, KrkValue a, KrkValue b, KrkValue *out) {
KrkClass * type = krk_getType(a); KrkClass * type = krk_getType(a);
KrkObj * method = *(KrkObj**)((char*)type + methodOffset); KrkObj * method = *(KrkObj**)((char*)type + methodOffset);