From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: sparse@chrisli.org
Cc: linux-sparse@vger.kernel.org, linux@rasmusvillemoes.dk,
Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Subject: [PATCH 4/4] Small test/exemple for using '-vdata'
Date: Sun, 1 Feb 2015 03:19:46 +0100 [thread overview]
Message-ID: <1422757186-8007-5-git-send-email-luc.vanoostenryck@gmail.com> (raw)
In-Reply-To: <1422757186-8007-1-git-send-email-luc.vanoostenryck@gmail.com>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
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
prev parent reply other threads:[~2015-02-01 2:20 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-30 22:16 Bad interaction between macro expansion and literal concatenation Rasmus Villemoes
2015-01-31 1:23 ` [PATCH] Avoid reuse of string buffer when concatening adjacent string litterals Luc Van Oostenryck
2015-02-03 22:38 ` Rasmus Villemoes
2015-02-04 0:32 ` Luc Van Oostenryck
2015-02-04 3:26 ` Christopher Li
2015-02-04 8:39 ` Rasmus Villemoes
2015-02-04 8:58 ` Rasmus Villemoes
2015-02-04 16:20 ` Christopher Li
2015-02-06 21:52 ` Rasmus Villemoes
2015-02-07 1:30 ` Christopher Li
2015-02-09 21:48 ` Damien Lespiau
2015-02-04 2:01 ` [PATCH v2] Avoid reusing string buffer when doing string expansion Luc Van Oostenryck
2015-02-04 5:30 ` Christopher Li
2015-02-04 6:22 ` Luc Van Oostenryck
2015-02-04 8:01 ` Christopher Li
2015-02-04 16:38 ` Christopher Li
2015-02-04 23:38 ` Luc Van Oostenryck
2015-02-06 13:58 ` Christopher Li
2015-02-06 20:32 ` Rasmus Villemoes
2015-02-04 23:38 ` Luc Van Oostenryck
2015-01-31 5:16 ` Bad interaction between macro expansion and literal concatenation Christopher Li
2015-02-01 2:19 ` [PATCH 0/4] Teach sparse to display data/initial values Luc Van Oostenryck
2015-02-01 2:19 ` [PATCH 1/4] Add support for '-vdata', the equivalent of '-ventry' but for data Luc Van Oostenryck
2015-02-01 2:19 ` [PATCH 2/4] Add support for show_data() Luc Van Oostenryck
2015-02-02 5:30 ` Christopher Li
2015-02-04 0:50 ` Luc Van Oostenryck
2015-02-01 2:19 ` [PATCH 3/4] Teach sparse to display data/initial values Luc Van Oostenryck
2015-02-01 2:19 ` Luc Van Oostenryck [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1422757186-8007-5-git-send-email-luc.vanoostenryck@gmail.com \
--to=luc.vanoostenryck@gmail.com \
--cc=linux-sparse@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=sparse@chrisli.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).