diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-09-01 21:22:01 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-09-01 21:45:09 +0200 |
| commit | 9059c1e96cba1fb20359cb161892e83688e259e1 (patch) | |
| tree | c062789e1e56fa8c76b67b2622a86a9e18c67883 /validation | |
| parent | ce2a7be626471bb155462aea3a6da24f374f9d04 (diff) | |
| parent | 53480c6b455437397fd9c9666429e305f93865c5 (diff) | |
| download | sparse-dev-9059c1e96cba1fb20359cb161892e83688e259e1.tar.gz | |
Merge branch 'has-attribute' into tip
* add support for __has_attribute()
Diffstat (limited to 'validation')
| -rw-r--r-- | validation/preprocessor/has-attribute.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/validation/preprocessor/has-attribute.c b/validation/preprocessor/has-attribute.c new file mode 100644 index 00000000..3149cbfa --- /dev/null +++ b/validation/preprocessor/has-attribute.c @@ -0,0 +1,56 @@ +#ifndef __has_attribute +__has_attribute()??? Quesako? +#define __has_attribute(x) 0 +#else +"has __has_attribute(), yeah!" +#endif + +123 __has_attribute(nothinx) def + +#if __has_attribute(nothinx) +#error "not a attribute!" +#endif + +#if 1 \ + && __has_attribute(packed) \ + && __has_attribute(aligned) \ + && __has_attribute(const) \ + && __has_attribute(pure) \ + && __has_attribute(noreturn) \ + && __has_attribute(designated_init) \ + && __has_attribute(transparent_union) \ + +"ok gcc" +#endif + +#if 1 \ + && __has_attribute(fastcall) \ + +"ok gcc ignore" +#endif + +#if 1 \ + && __has_attribute(nocast) \ + && __has_attribute(noderef) \ + && __has_attribute(safe) \ + && __has_attribute(force) \ + && __has_attribute(bitwise) \ + && __has_attribute(address_space) \ + && __has_attribute(context) \ + +"ok sparse specific" +#endif + +/* + * check-name: has-attribute + * check-command: sparse -E $file + * + * check-output-start + +"has __has_attribute(), yeah!" +123 0 def +"ok gcc" +"ok gcc ignore" +"ok sparse specific" + * check-output-end + */ |
