new file mode 100644
@@ -0,0 +1,13 @@
+typedef int int_t;
+typedef int int_t;
+
+/*
+ * check-name: typedef-redef-c89
+ * check-command: sparse -std=c89 --pedantic $file
+ * check-known-to-fail
+ *
+ * check-error-start
+typedef-redef-c89.c:2:13: warning: redefinition of typedef 'int_t'
+typedef-redef-c89.c:1:13: info: originally defined here
+ * check-error-end
+ */
new file mode 100644
@@ -0,0 +1,14 @@
+typedef int ok_t;
+typedef int ok_t;
+
+typedef int ko_t;
+typedef long ko_t;
+
+/*
+ * check-name: typedef-redef
+ * check-known-to-fail
+ *
+ * check-error-start
+typedef-redef.c:5:14: error: symbol 'ko_t' redeclared with different type (originally declared at typedef-redef.c:4) - different type sizes
+ * check-error-end
+ */
Currently, sparse doesn't issue a diagnostic when a typedef is redefined. Add some testcases for this. Reported-by: Matthew Wilcox <willy@infradead.org> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> --- validation/typedef-redef-c89.c | 13 +++++++++++++ validation/typedef-redef.c | 14 ++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 validation/typedef-redef-c89.c create mode 100644 validation/typedef-redef.c