|
30 | 30 | # define __GCC4_has_attribute___assume_aligned__ (__GNUC_MINOR__ >= 9)
|
31 | 31 | # define __GCC4_has_attribute___copy__ 0
|
32 | 32 | # define __GCC4_has_attribute___designated_init__ 0
|
| 33 | +# define __GCC4_has_attribute___error__ 1 |
33 | 34 | # define __GCC4_has_attribute___externally_visible__ 1
|
34 | 35 | # define __GCC4_has_attribute___no_caller_saved_registers__ 0
|
35 | 36 | # define __GCC4_has_attribute___noclone__ 1
|
|
38 | 39 | # define __GCC4_has_attribute___no_sanitize_undefined__ (__GNUC_MINOR__ >= 9)
|
39 | 40 | # define __GCC4_has_attribute___no_sanitize_coverage__ 0
|
40 | 41 | # define __GCC4_has_attribute___fallthrough__ 0
|
| 42 | +# define __GCC4_has_attribute___warning__ 1 |
41 | 43 | #endif
|
42 | 44 |
|
43 | 45 | /*
|
|
137 | 139 | # define __designated_init
|
138 | 140 | #endif
|
139 | 141 |
|
| 142 | +/* |
| 143 | + * Optional: only supported since clang >= 14.0 |
| 144 | + * |
| 145 | + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-error-function-attribute |
| 146 | + */ |
| 147 | +#if __has_attribute(__error__) |
| 148 | +# define __compiletime_error(msg) __attribute__((__error__(msg))) |
| 149 | +#else |
| 150 | +# define __compiletime_error(msg) |
| 151 | +#endif |
| 152 | + |
140 | 153 | /*
|
141 | 154 | * Optional: not supported by clang
|
142 | 155 | *
|
|
286 | 299 | */
|
287 | 300 | #define __must_check __attribute__((__warn_unused_result__))
|
288 | 301 |
|
| 302 | +/* |
| 303 | + * Optional: only supported since clang >= 14.0 |
| 304 | + * |
| 305 | + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-warning-function-attribute |
| 306 | + */ |
| 307 | +#if __has_attribute(__warning__) |
| 308 | +# define __compiletime_warning(msg) __attribute__((__warning__(msg))) |
| 309 | +#else |
| 310 | +# define __compiletime_warning(msg) |
| 311 | +#endif |
| 312 | + |
289 | 313 | /*
|
290 | 314 | * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-weak-function-attribute
|
291 | 315 | * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-weak-variable-attribute
|
|
0 commit comments