aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation
diff options
Diffstat (limited to 'validation')
-rw-r--r--validation/Wuniv-init-ko.c17
-rw-r--r--validation/Wuniv-init-ok.c18
2 files changed, 35 insertions, 0 deletions
diff --git a/validation/Wuniv-init-ko.c b/validation/Wuniv-init-ko.c
index 315c211a..1fb5669f 100644
--- a/validation/Wuniv-init-ko.c
+++ b/validation/Wuniv-init-ko.c
@@ -4,11 +4,28 @@ struct s {
static struct s s = { 0 };
+static int a = { 0 };
+static int b = { };
+static int c = { 1, 2 };
+static struct s *ptr = { 0 };
+
+struct o {
+ struct i {
+ int a;
+ };
+};
+
+static struct o o = { 0 };
/*
* check-name: univ-init-ko
+ * check-command: sparse -Wuniversal-initializer $file
*
* check-error-start
Wuniv-init-ko.c:6:23: warning: Using plain integer as NULL pointer
+Wuniv-init-ko.c:8:16: error: invalid initializer
+Wuniv-init-ko.c:9:16: error: invalid initializer
+Wuniv-init-ko.c:10:26: warning: Using plain integer as NULL pointer
+Wuniv-init-ko.c:18:23: warning: missing braces around initializer
* check-error-end
*/
diff --git a/validation/Wuniv-init-ok.c b/validation/Wuniv-init-ok.c
index c3964751..1f0c3dcb 100644
--- a/validation/Wuniv-init-ok.c
+++ b/validation/Wuniv-init-ok.c
@@ -4,8 +4,26 @@ struct s {
static struct s s = { 0 };
+static int a = { 0 };
+static int b = { };
+static int c = { 1, 2 };
+static struct s *ptr = { 0 };
+
+struct o {
+ struct i {
+ int a;
+ };
+};
+
+static struct o o = { 0 };
/*
* check-name: univ-init-ok
* check-command: sparse -Wno-universal-initializer $file
+ *
+ * check-error-start
+Wuniv-init-ok.c:8:16: error: invalid initializer
+Wuniv-init-ok.c:9:16: error: invalid initializer
+Wuniv-init-ok.c:10:26: warning: Using plain integer as NULL pointer
+ * check-error-end
*/