unreachable code: don't warn about empty statements
[smatch.git] / validation / sm_macros.c
blob896b9a99d13ce66415fb8912ac756c48360fd2aa
1 #include "check_debug.h"
3 #define add(x, y) x + y
4 #define sub(x, y) x - y
6 int x;
7 void func(int *p)
9 int a = 1;
10 int b = 2;
12 x = 4 * add(2, 3);
13 x = 4 + add(2, 3);
14 x = 4 * add(2, 3) * 8;
15 x = add(2, 3) * 4;
16 x = add(2, 3) - 4;
17 x = -sub(2, 3);
18 x = sub(2, 3)++;
21 * check-name: Smatch macro precedence bugs
22 * check-command: smatch -I.. sm_macros.c
24 * check-output-start
25 sm_macros.c:12 func() warn: the 'add' macro might need parens
26 sm_macros.c:14 func() warn: the 'add' macro might need parens
27 sm_macros.c:14 func() warn: the 'add' macro might need parens
28 sm_macros.c:15 func() warn: the 'add' macro might need parens
29 sm_macros.c:17 func() warn: the 'sub' macro might need parens
30 sm_macros.c:18 func() warn: the 'sub' macro might need parens
31 * check-output-end