#include <os/trace_base.h>

os/trace_base.h

15 macros · 1 variable

macroOS_LOG_FORMATLIKE

#define OS_LOG_FORMATLIKE(x, y) __attribute__((format(os_log, x, y)))

macroOS_LOG_TARGET_HAS_10_15_FEATURES

#define OS_LOG_TARGET_HAS_10_15_FEATURES 1

macroOS_LOG_TARGET_HAS_10_14_FEATURES

#define OS_LOG_TARGET_HAS_10_14_FEATURES 1

macroOS_LOG_TARGET_HAS_10_13_FEATURES

#define OS_LOG_TARGET_HAS_10_13_FEATURES 1

macroOS_LOG_TARGET_HAS_10_12_FEATURES

#define OS_LOG_TARGET_HAS_10_12_FEATURES 1

macroOS_COUNT_ARGS

#define OS_COUNT_ARGS(...) OS_COUNT_ARGS1(, ##__VA_ARGS__, _8, _7, _6, _5, _4, _3, _2, _1, _0)

macroOS_COUNT_ARGS1

#define OS_COUNT_ARGS1(z, a, b, c, d, e, f, g, h, cnt, ...) cnt

macroOS_LOG_FORMAT_ERRORS

#define OS_LOG_FORMAT_ERRORS _Pragma("clang diagnostic error \"-Wformat\"")

macroOS_LOG_PRAGMA_PUSH

#define OS_LOG_PRAGMA_PUSH _Pragma("clang diagnostic push")
        _Pragma("clang diagnostic ignored \"-Wvla\"")
        OS_LOG_FORMAT_ERRORS

macroOS_LOG_PRAGMA_POP

#define OS_LOG_PRAGMA_POP _Pragma("clang diagnostic pop")

macroOS_LOG_UNINITIALIZED

#define OS_LOG_UNINITIALIZED __attribute__((uninitialized))

macroOS_LOG_STRING

#define OS_LOG_STRING(_ns, _var, _str) _Static_assert(__builtin_constant_p(_str),
                "format/label/description argument must be a string constant");
        __attribute__((section("__TEXT,__oslogstring,cstring_literals"),internal_linkage))
        static const char _var[] __asm(OS_STRINGIFY(OS_CONCAT(LOS_##_ns, __COUNTER__))) = _str

macroOS_LOG_REMOVE_PARENS

#define OS_LOG_REMOVE_PARENS(...) __VA_ARGS__

macroOS_LOG_CALL_WITH_FORMAT

#define OS_LOG_CALL_WITH_FORMAT(fun, fun_args, fmt, ...) __extension__({
        OS_LOG_PRAGMA_PUSH OS_LOG_STRING(LOG, _os_fmt_str, fmt);
        uint8_t _Alignas(16) OS_LOG_UNINITIALIZED _os_fmt_buf[__builtin_os_log_format_buffer_size(fmt, ##__VA_ARGS__)];
        fun(OS_LOG_REMOVE_PARENS fun_args, _os_fmt_str,
                (uint8_t *)__builtin_os_log_format(_os_fmt_buf, fmt, ##__VA_ARGS__),
                (uint32_t)sizeof(_os_fmt_buf)) OS_LOG_PRAGMA_POP;
})

macroOS_LOG_CALL_WITH_FORMAT_NAME

#define OS_LOG_CALL_WITH_FORMAT_NAME(fun, fun_args, name, fmt, ...) __extension__({
        OS_LOG_PRAGMA_PUSH OS_LOG_STRING(LOG, _os_fmt_str, fmt);
        OS_LOG_STRING(LOG, _os_name_str, name);
        uint8_t _Alignas(16) OS_LOG_UNINITIALIZED _os_fmt_buf[__builtin_os_log_format_buffer_size(fmt, ##__VA_ARGS__)];
        fun(OS_LOG_REMOVE_PARENS fun_args, _os_name_str, _os_fmt_str,
                (uint8_t *)__builtin_os_log_format(_os_fmt_buf, fmt, ##__VA_ARGS__),
                (uint32_t)sizeof(_os_fmt_buf)) OS_LOG_PRAGMA_POP;
})

variable__dso_handle

extern struct mach_header __dso_handle