From: Masatake YAMATO <yamato@redhat.com>
To: linux-sparse@vger.kernel.org
Cc: yamato@redhat.com
Subject: [PATCH 2/3] Test case for -Winit-cstring option
Date: Sun, 7 Apr 2013 01:58:56 +0900 [thread overview]
Message-ID: <1365267537-3787-2-git-send-email-yamato@redhat.com> (raw)
In-Reply-To: <1365267537-3787-1-git-send-email-yamato@redhat.com>
This patch added a test case for -Winit-cstring option
to validation directory.
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
---
validation/init_cstring.c | 11 +++++++++++
1 file changed, 11 insertions(+)
create mode 100644 validation/init_cstring.c
diff --git a/validation/init_cstring.c b/validation/init_cstring.c
new file mode 100644
index 0000000..00eca20
--- /dev/null
+++ b/validation/init_cstring.c
@@ -0,0 +1,11 @@
+static struct alpha {
+ char a[2];
+} x = { .a = "ab" };
+/*
+ * check-name: -Winit-cstring option
+ *
+ * check-command: sparse -Winit-cstring $file
+ * check-error-start
+init_cstring.c:3:14: warning: too long initializer-string for array of char(no space for nul char)
+ * check-error-end
+ */
--
1.7.11.7
next prev parent reply other threads:[~2013-04-06 17:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-06 16:58 [PATCH 1/3] Warn about initialization of a char array with a too long constant C string Masatake YAMATO
2013-04-06 16:58 ` Masatake YAMATO [this message]
2013-04-06 16:58 ` [PATCH 3/3] Add description for -Winit-cstring option Masatake YAMATO
2013-04-22 16:42 ` [PATCH 1/3] Warn about initialization of a char array with a too long constant C string Christopher Li
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=1365267537-3787-2-git-send-email-yamato@redhat.com \
--to=yamato@redhat.com \
--cc=linux-sparse@vger.kernel.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).