File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 2121#define LLVM_LIBC_FUNCTION_ATTR
2222#endif
2323
24+ // Allow each function `func` can have extra attributes specified by defining:
25+ // `LLVM_LIBC_FUNCTION_ATTR_func` macro, which should always start with
26+ // "LLVM_LIBC_EMPTY,"
27+ //
28+ // For example:
29+ // #define LLVM_LIBC_FUNCTION_ATTR_memcpy LLVM_LIBC_EMPTY, __attribute__((weak))
30+ #define LLVM_LIBC_EMPTY
31+
32+ #define GET_SECOND (first, second, ...) second
33+ #define EXPAND_THEN_SECOND (name ) GET_SECOND(name, LLVM_LIBC_EMPTY, )
34+
35+ #define LLVM_LIBC_ATTR (name ) EXPAND_THEN_SECOND(LLVM_LIBC_FUNCTION_ATTR_##name)
36+ #define EXPAND_ATTR (name ) LLVM_LIBC_ATTR(name)
37+
2438// MacOS needs to be excluded because it does not support aliasing.
2539#if defined(LIBC_COPT_PUBLIC_PACKAGING) && (!defined(__APPLE__))
2640#define LLVM_LIBC_FUNCTION_IMPL (type, name, arglist ) \
41+ EXPAND_ATTR (name) \
2742 LLVM_LIBC_FUNCTION_ATTR decltype(LIBC_NAMESPACE::name) \
2843 __##name##_impl__ __asm__ (#name); \
2944 decltype (LIBC_NAMESPACE::name) name [[gnu::alias(#name)]]; \
You can’t perform that action at this time.
0 commit comments