[all-commits] [llvm/llvm-project] 6cfbf8: [libc] add support for function level attributes (...
Schrodinger ZHU Yifan via All-commits
all-commits at lists.llvm.org
Thu Feb 15 09:21:04 PST 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 6cfbf8ccce8295b5d130c48a76a134da5f6194ae
https://github.com/llvm/llvm-project/commit/6cfbf8ccce8295b5d130c48a76a134da5f6194ae
Author: Schrodinger ZHU Yifan <yifanzhu at rochester.edu>
Date: 2024-02-15 (Thu, 15 Feb 2024)
Changed paths:
M libc/spec/spec.td
M libc/spec/stdc.td
M libc/utils/HdrGen/PublicAPICommand.cpp
M libc/utils/HdrGen/PublicAPICommand.h
Log Message:
-----------
[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
```
More information about the All-commits
mailing list