new file mode 100644
@@ -0,0 +1,13 @@
+#define __unqual_typeof(x) typeof(((void)0, (x)))
+
+int *foo(volatile int x);
+int *foo(volatile int x)
+{
+ extern __unqual_typeof(x) y;
+ return &y;
+}
+
+/*
+ * check-name: unqual-comma
+ * check-known-to-fail
+ */
new file mode 100644
@@ -0,0 +1,23 @@
+static void test_volatile(void)
+{
+ volatile int x = 0;
+ int *pp;
+
+ typeof(++x) v1; pp = &v1; // KO
+ typeof(x++) v2; pp = &v2; // KO
+}
+
+/*
+ * check-name: unqual-postop
+ * check-command: sparse -Wno-declaration-after-statement $file
+ * check-known-to-fail
+ *
+ * check-error-start
+eval/unqual-postop.c:6:40: warning: incorrect type in assignment (different modifiers)
+eval/unqual-postop.c:6:40: expected int *pp
+eval/unqual-postop.c:6:40: got int volatile *
+eval/unqual-postop.c:7:40: warning: incorrect type in assignment (different modifiers)
+eval/unqual-postop.c:7:40: expected int *pp
+eval/unqual-postop.c:7:40: got int volatile *
+ * check-error-end
+ */
new file mode 100644
@@ -0,0 +1,13 @@
+#define __unqual_typeof(x) typeof(({ x; }))
+
+int *foo(volatile int x);
+int *foo(volatile int x)
+{
+ extern __unqual_typeof(x) y;
+ return &y;
+}
+
+/*
+ * check-name: unqual-stmt-expr
+ * check-known-to-fail
+ */
new file mode 100644
@@ -0,0 +1,26 @@
+static void test_const(volatile int x)
+{
+ const int x = 0;
+ typeof(1?x:x) i3; i3 = 0; // should be OK
+ typeof(+x) i4; i4 = 0; // should be OK
+ typeof(-x) i5; i5 = 0; // should be OK
+ typeof(!x) i6; i6 = 0; // should be OK
+ typeof(x+x) i7; i7 = 0; // should be OK
+}
+
+static void test_volatile(void)
+{
+ volatile int x = 0;
+ int *pp;
+
+ typeof(1?x:x) i3; pp = &i3; // should be OK
+ typeof(+x) i4; pp = &i4; // should be OK
+ typeof(-x) i5; pp = &i5; // should be OK
+ typeof(!x) i6; pp = &i6; // should be OK
+ typeof(x+x) i7; pp = &i7; // should be OK
+}
+
+/*
+ * check-name: unqual02
+ * check-command: sparse -Wno-declaration-after-statement $file
+ */
Add some testcases related to qualifier dropping / lvalue conversion. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> --- validation/eval/unqual-comma.c | 13 +++++++++++++ validation/eval/unqual-postop.c | 23 +++++++++++++++++++++++ validation/eval/unqual-stmt-expr.c | 13 +++++++++++++ validation/eval/unqual02.c | 26 ++++++++++++++++++++++++++ 4 files changed, 75 insertions(+) create mode 100644 validation/eval/unqual-comma.c create mode 100644 validation/eval/unqual-postop.c create mode 100644 validation/eval/unqual-stmt-expr.c create mode 100644 validation/eval/unqual02.c