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