Unverified Commit 6cfbf8cc authored by Schrodinger ZHU Yifan's avatar Schrodinger ZHU Yifan Committed by GitHub
Browse files

[libc] add support for function level attributes (#79891)

See discussion at
https://discourse.llvm.org/t/rfc-support-function-attributes-in-user-interface/76624

Demo macro:
```c++
#if !defined(__LIBC_CONST_ATTR) && defined(__cplusplus) && defined(__GNUC__)
#if __has_attribute(const)
#define __LIBC_CONST_ATTR [[gnu::const]]
#endif
#endif
#if !defined(__LIBC_CONST_ATTR) && defined(__GNUC__)
#if __has_attribute(const)
#define __LIBC_CONST_ATTR __attribute__((const))
#endif
#endif
#if !defined(__LIBC_CONST_ATTR)
#define __LIBC_CONST_ATTR
#endif
```
parent 54826d49
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment