diff mbox series

[1/3] add testcase for incorrect empty expressions

Message ID 20200714000030.85886-2-luc.vanoostenryck@gmail.com (mailing list archive)
State Mainlined, archived
Headers show
Series warn on empty expressions | expand

Commit Message

Luc Van Oostenryck July 14, 2020, midnight UTC
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 validation/empty-assign.c      | 14 ++++++++++++++
 validation/empty-initializer.c | 10 ++++++++++
 2 files changed, 24 insertions(+)
 create mode 100644 validation/empty-assign.c
 create mode 100644 validation/empty-initializer.c
diff mbox series

Patch

diff --git a/validation/empty-assign.c b/validation/empty-assign.c
new file mode 100644
index 000000000000..48ac626ddaed
--- /dev/null
+++ b/validation/empty-assign.c
@@ -0,0 +1,14 @@ 
+static int foo(int a)
+{
+	a = ;			// KO
+	return a;
+}
+
+/*
+ * check-name: empty-assign
+ * check-known-to-fail
+ *
+ * check-error-start
+empty-assign.c:3:11: error: expression expected before ';'
+ * check-error-end
+ */
diff --git a/validation/empty-initializer.c b/validation/empty-initializer.c
new file mode 100644
index 000000000000..0ca763f699a0
--- /dev/null
+++ b/validation/empty-initializer.c
@@ -0,0 +1,10 @@ 
+static int i = ;		// KO
+
+/*
+ * check-name: empty-initializer
+ * check-known-to-fail
+ *
+ * check-error-start
+empty-initializer.c:1:16: error: expression expected before ';'
+ * check-error-end
+ */