xref: /btstack/tool/misc/append_u_to_constants.cocci (revision 6c87a5c39f34bf2c0c673dcf036c4228fafdc291)
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