xref: /btstack/tool/misc/append_u_to_constants.cocci (revision f400efd4c34c2c3d094122d9c99ddcc5357e2a2e)
1//
2// append 'u' suffix to decimal or hexadecimal constants
3//
4
5@r1@
6// match decimal or hexadecimal constant without suffix 'u'
7constant C =~ "^[(0x)0-9a-fA-F]+$";
8@@
9  C
10
11@script:python p@
12// define Cu := C + 'u'
13C << r1.C;
14Cu;
15@@
16coccinelle.Cu = coccinelle.C + 'u'
17
18@@
19// replace C with Cu
20constant r1.C;
21identifier p.Cu;
22@@
23- C
24+ Cu
25
26