aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation
diff options
authorAl Viro <viro@ftp.linux.org.uk>2009-03-09 07:11:38 +0000
committerChristopher Li <sparse@chrisli.org>2009-07-17 23:06:23 +0000
commit2014558122f10251072ff574c6e3852df1939f78 (patch)
tree56520b1c32ef299bcf9f3ecbc50b74fe45ab98ee /validation
parent82214d8e48071fde1d6b250a1eba8acccde66006 (diff)
downloadsparse-dev-2014558122f10251072ff574c6e3852df1939f78.tar.gz
Fix handling of typedefs with several declarators
We set MOD_USERTYPE only on the first one, so declaration_specifiers didn't recognize something like unsigned P; where P had been such a typedef as redefinition (see the testcase). Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Christopher Li <sparse@chrisli.org>
Diffstat (limited to 'validation')
-rw-r--r--validation/multi_typedef.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/validation/multi_typedef.c b/validation/multi_typedef.c
new file mode 100644
index 00000000..d9ffd0f7
--- /dev/null
+++ b/validation/multi_typedef.c
@@ -0,0 +1,15 @@
+typedef int T, *P;
+static void f(void)
+{
+ unsigned P = 0;
+ unsigned x = P;
+}
+static void g(void)
+{
+ int P = 0;
+ int x = P;
+}
+/*
+ * check-name: typedefs with many declarators
+ * check-description: we didn't recognize P above as a typedef
+ */