absolute: track the absolute limits that variables can be
[smatch.git] / validation / sm_macros.c
blob73d552493b20a9aa51c9bdfd232675080d320eac
1 #include "check_debug.h"
3 #define add(x, y) x + y
4 #define sub(x, y) x - y
6 void func(int *p)
8 int a = 1;
9 int b = 2;
11 x = 4 * add(2, 3);
12 x = 4 + add(2, 3);
13 x = 4 * add(2, 3) * 8;
14 x = add(2, 3) * 4;
15 x = add(2, 3) - 4;
16 x = -sub(2, 3);
17 x = sub(2, 3)++;
20 * check-name: Smatch macro precedence bugs
21 * check-command: smatch -I.. sm_macros.c
23 * check-output-start
24 sm_macros.c:11 func() warn: the 'add' macro might need parens
25 sm_macros.c:13 func() warn: the 'add' macro might need parens
26 sm_macros.c:13 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:16 func() warn: the 'sub' macro might need parens
29 sm_macros.c:17 func() warn: the 'sub' macro might need parens
30 * check-output-end