|
100 | 100 | # define __copy(symbol)
|
101 | 101 | #endif
|
102 | 102 |
|
| 103 | +/* |
| 104 | + * Optional: not supported by gcc |
| 105 | + * Optional: only supported since clang >= 14.0 |
| 106 | + * Optional: not supported by icc |
| 107 | + * |
| 108 | + * clang: https://clang.llvm.org/docs/AttributeReference.html#diagnose_as_builtin |
| 109 | + */ |
| 110 | +#if __has_attribute(__diagnose_as_builtin__) |
| 111 | +# define __diagnose_as(builtin...) __attribute__((__diagnose_as_builtin__(builtin))) |
| 112 | +#else |
| 113 | +# define __diagnose_as(builtin...) |
| 114 | +#endif |
| 115 | + |
103 | 116 | /*
|
104 | 117 | * Don't. Just don't. See commit 771c035372a0 ("deprecate the '__deprecated'
|
105 | 118 | * attribute warnings entirely and for good") for more information.
|
|
257 | 270 | */
|
258 | 271 | #define __noreturn __attribute__((__noreturn__))
|
259 | 272 |
|
| 273 | +/* |
| 274 | + * Optional: not supported by gcc. |
| 275 | + * Optional: not supported by icc. |
| 276 | + * |
| 277 | + * clang: https://clang.llvm.org/docs/AttributeReference.html#overloadable |
| 278 | + */ |
| 279 | +#if __has_attribute(__overloadable__) |
| 280 | +# define __overloadable __attribute__((__overloadable__)) |
| 281 | +#else |
| 282 | +# define __overloadable |
| 283 | +#endif |
| 284 | + |
260 | 285 | /*
|
261 | 286 | * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Type-Attributes.html#index-packed-type-attribute
|
262 | 287 | * clang: https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-packed-variable-attribute
|
263 | 288 | */
|
264 | 289 | #define __packed __attribute__((__packed__))
|
265 | 290 |
|
| 291 | +/* |
| 292 | + * Note: the "type" argument should match any __builtin_object_size(p, type) usage. |
| 293 | + * |
| 294 | + * Optional: not supported by gcc. |
| 295 | + * Optional: not supported by icc. |
| 296 | + * |
| 297 | + * clang: https://clang.llvm.org/docs/AttributeReference.html#pass-object-size-pass-dynamic-object-size |
| 298 | + */ |
| 299 | +#if __has_attribute(__pass_object_size__) |
| 300 | +# define __pass_object_size(type) __attribute__((__pass_object_size__(type))) |
| 301 | +#else |
| 302 | +# define __pass_object_size(type) |
| 303 | +#endif |
| 304 | + |
266 | 305 | /*
|
267 | 306 | * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-pure-function-attribute
|
268 | 307 | */
|
|
0 commit comments