[PATCH 2/3] Test case for -Winit-cstring option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch added a test case for -Winit-cstring option
to validation directory.

Signed-off-by: Masatake YAMATO <yamato@xxxxxxxxxx>
---
 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

--
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




[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux