xref: /openbmc/qemu/scripts/coccinelle/err-bad-newline.cocci (revision e68808a797d0c585b0e82e4a788d1ba8899b01eb)
1df3c286cSMarkus Armbruster// Error messages should not contain newlines.  This script finds
2df3c286cSMarkus Armbruster// messages that do.  Fixing them is manual.
3df3c286cSMarkus Armbruster@r@
4*cb3fa1e4SMarkus Armbrusterexpression errp, err, eno, cls, fmt, ap;
5df3c286cSMarkus Armbrusterposition p;
6df3c286cSMarkus Armbruster@@
7df3c286cSMarkus Armbruster(
8*cb3fa1e4SMarkus Armbrustererror_vreport(fmt, ap)@p
9*cb3fa1e4SMarkus Armbruster|
10*cb3fa1e4SMarkus Armbrusterwarn_vreport(fmt, ap)@p
11*cb3fa1e4SMarkus Armbruster|
12*cb3fa1e4SMarkus Armbrusterinfo_vreport(fmt, ap)@p
13*cb3fa1e4SMarkus Armbruster|
14df3c286cSMarkus Armbrustererror_report(fmt, ...)@p
15df3c286cSMarkus Armbruster|
16*cb3fa1e4SMarkus Armbrusterwarn_report(fmt, ...)@p
17*cb3fa1e4SMarkus Armbruster|
18*cb3fa1e4SMarkus Armbrusterinfo_report(fmt, ...)@p
19*cb3fa1e4SMarkus Armbruster|
20*cb3fa1e4SMarkus Armbrustererror_report_once(fmt, ...)@p
21*cb3fa1e4SMarkus Armbruster|
22*cb3fa1e4SMarkus Armbrusterwarn_report_once(fmt, ...)@p
23*cb3fa1e4SMarkus Armbruster|
24df3c286cSMarkus Armbrustererror_setg(errp, fmt, ...)@p
25df3c286cSMarkus Armbruster|
26df3c286cSMarkus Armbrustererror_setg_errno(errp, eno, fmt, ...)@p
27df3c286cSMarkus Armbruster|
28df3c286cSMarkus Armbrustererror_setg_win32(errp, eno, cls, fmt, ...)@p
29df3c286cSMarkus Armbruster|
30*cb3fa1e4SMarkus Armbrustererror_propagate_prepend(errp, err, fmt, ...)@p
31*cb3fa1e4SMarkus Armbruster|
32*cb3fa1e4SMarkus Armbrustererror_vprepend(errp, fmt, ap)@p
33*cb3fa1e4SMarkus Armbruster|
34df3c286cSMarkus Armbrustererror_prepend(errp, fmt, ...)@p
35df3c286cSMarkus Armbruster|
36df3c286cSMarkus Armbrustererror_setg_file_open(errp, eno, cls, fmt, ...)@p
37df3c286cSMarkus Armbruster|
38*cb3fa1e4SMarkus Armbrusterwarn_reportf_err(errp, fmt, ...)@p
39*cb3fa1e4SMarkus Armbruster|
40df3c286cSMarkus Armbrustererror_reportf_err(errp, fmt, ...)@p
41df3c286cSMarkus Armbruster|
42df3c286cSMarkus Armbrustererror_set(errp, cls, fmt, ...)@p
43df3c286cSMarkus Armbruster)
44df3c286cSMarkus Armbruster@script:python@
45df3c286cSMarkus Armbrusterfmt << r.fmt;
46df3c286cSMarkus Armbrusterp << r.p;
47df3c286cSMarkus Armbruster@@
48df3c286cSMarkus Armbrusterif "\\n" in str(fmt):
49*cb3fa1e4SMarkus Armbruster    print("%s:%s:%s:%s" % (p[0].file, p[0].line, p[0].column, fmt))
50