diff options
Diffstat (limited to 'validation/preprocessor')
| -rw-r--r-- | validation/preprocessor/base-file.c | 17 | ||||
| -rw-r--r-- | validation/preprocessor/base-file.h | 2 | ||||
| -rw-r--r-- | validation/preprocessor/builtin.c | 17 | ||||
| -rw-r--r-- | validation/preprocessor/dynamic.c | 37 | ||||
| -rw-r--r-- | validation/preprocessor/has-builtin.c | 43 | ||||
| -rw-r--r-- | validation/preprocessor/include-level.c | 14 | ||||
| -rw-r--r-- | validation/preprocessor/include-level.h | 1 |
7 files changed, 131 insertions, 0 deletions
diff --git a/validation/preprocessor/base-file.c b/validation/preprocessor/base-file.c new file mode 100644 index 00000000..61a290cb --- /dev/null +++ b/validation/preprocessor/base-file.c @@ -0,0 +1,17 @@ +__FILE__ +__BASE_FILE__ + +#include "base-file.h" + +/* + * check-name: base file + * check-command: sparse -E $file + * + * check-output-start + +"preprocessor/base-file.c" +"preprocessor/base-file.c" +"preprocessor/base-file.h" +"preprocessor/base-file.c" + * check-output-end + */ diff --git a/validation/preprocessor/base-file.h b/validation/preprocessor/base-file.h new file mode 100644 index 00000000..018b16c5 --- /dev/null +++ b/validation/preprocessor/base-file.h @@ -0,0 +1,2 @@ +__FILE__ +__BASE_FILE__ diff --git a/validation/preprocessor/builtin.c b/validation/preprocessor/builtin.c new file mode 100644 index 00000000..6c3aa176 --- /dev/null +++ b/validation/preprocessor/builtin.c @@ -0,0 +1,17 @@ +__CHECKER__ +F(__CHECKER__,__CHECKER__) +S(#__CHECKER__) +const char str[] = "__CHECKER__"; + +/* + * check-name: builtin + * check-command: sparse -E $file + * + * check-output-start + +1 +F(1,1) +S(#1) +const char str[] = "__CHECKER__"; + * check-output-end + */ diff --git a/validation/preprocessor/dynamic.c b/validation/preprocessor/dynamic.c new file mode 100644 index 00000000..f791ba39 --- /dev/null +++ b/validation/preprocessor/dynamic.c @@ -0,0 +1,37 @@ +#if defined(__LINE__) +__LINE__ +#endif +#if defined(__FILE__) +__FILE__ +#endif +#if defined(__BASE_FILE__) +__BASE_FILE__ +#endif +#if defined(__DATE__) +date +#endif +#if defined(__TIME__) +time +#endif +#if defined(__COUNTER__) +counter +#endif +#if defined(__INCLUDE_LEVEL__) +__INCLUDE_LEVEL__ +#endif + +/* + * check-name: dynamic-macros + * check-command: sparse -E $file + * + * check-output-start + +2 +"preprocessor/dynamic.c" +"preprocessor/dynamic.c" +date +time +counter +0 + * check-output-end + */ diff --git a/validation/preprocessor/has-builtin.c b/validation/preprocessor/has-builtin.c new file mode 100644 index 00000000..03272fc9 --- /dev/null +++ b/validation/preprocessor/has-builtin.c @@ -0,0 +1,43 @@ +#ifndef __has_builtin +__has_builtin()??? Quesako? +#define __has_builtin(x) 0 +#else +"has __has_builtin(), yeah!" +#endif + +#if __has_builtin(nothing) +#error "not a builtin!" +#endif + +#if __has_builtin(__builtin_offsetof) \ + || __has_builtin(__builtin_types_compatible_p) +#error "builtin ops are not builtin functions!" +#endif + +#if __has_builtin(__builtin_va_list) \ + || __has_builtin(__builtin_ms_va_list) +#error "builtin types are not builtin functions!" +#endif + +#if __has_builtin(__builtin_abs) +abs +#endif + +#if __has_builtin(__builtin_constant_p) +constant_p +#endif + +123 __has_builtin(abc) def + +/* + * check-name: has-builtin + * check-command: sparse -E $file + * + * check-output-start + +"has __has_builtin(), yeah!" +abs +constant_p +123 0 def + * check-output-end + */ diff --git a/validation/preprocessor/include-level.c b/validation/preprocessor/include-level.c new file mode 100644 index 00000000..b5e5e603 --- /dev/null +++ b/validation/preprocessor/include-level.c @@ -0,0 +1,14 @@ +__FILE__: __INCLUDE_LEVEL__ + +#include "include-level.h" + +/* + * check-name: include-level + * check-command: sparse -E $file + * + * check-output-start + +"preprocessor/include-level.c": 0 +"preprocessor/include-level.h": 1 + * check-output-end + */ diff --git a/validation/preprocessor/include-level.h b/validation/preprocessor/include-level.h new file mode 100644 index 00000000..cbc10182 --- /dev/null +++ b/validation/preprocessor/include-level.h @@ -0,0 +1 @@ +__FILE__: __INCLUDE_LEVEL__ |
