Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> --- validation/show_data.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 validation/show_data.c diff --git a/validation/show_data.c b/validation/show_data.c new file mode 100644 index 00000000..b620b610 --- /dev/null +++ b/validation/show_data.c @@ -0,0 +1,75 @@ +#define P "\001" + +static const char a[] = P "a"; +static const char b[] = P "b"; + +static const char *c = "abc"; + +static int i = 42; + +static int *ipi = &i; +static void *vpi = &i; + +struct s { + int i; +}; +static struct s s = { + .i = 42, +}; + +union u { + int i; + void *p; +}; +static union u u = { + .i = 42, +}; + +enum e { + first, + next, + last +}; +static enum e e = next; +/* + * check-name: show_data.c + * check-command: sparse -m32 -vdata $file + * check-output-start: +symbol a: + char static const [toplevel] a[0] + bit_size = 24 + val = "\1a" +symbol b: + char static const [toplevel] b[0] + bit_size = 32 + val = "\1b" +symbol c: + char const *static [toplevel] c + bit_size = 32 + val = &"abc" +symbol i: + int static [signed] [addressable] [toplevel] i + bit_size = 32 + val = 42 +symbol ipi: + int *static [toplevel] ipi + bit_size = 32 + val = &i +symbol vpi: + void *static [toplevel] vpi + bit_size = 32 + val = &i +symbol s: + struct s static [toplevel] s + bit_size = 32 + val = { } +symbol u: + union u static [toplevel] u + bit_size = 32 + val = { } +symbol e: + int enum e static [signed] [toplevel] e + bit_size = 32 + val = 1 + * check-output-end + */ -- 2.2.0 -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html