1 // SPDX-License-Identifier: GPL-2.0-only
3 /// Catch strings ending in newline with GENL_SET_ERR_MSG, NL_SET_ERR_MSG,
4 /// NL_SET_ERR_MSG_MOD.
6 // Confidence: Very High
7 // Copyright: (C) 2020 Intel Corporation
8 // URL: http://coccinelle.lip6.fr/
9 // Options: --no-includes --include-headers
15 @r depends on context || org || report@
20 \(GENL_SET_ERR_MSG\|NL_SET_ERR_MSG\|NL_SET_ERR_MSG_MOD\)(e,m@p)
26 if not m.endswith("\\n\""):
27 cocci.include_match(False)
37 //----------------------------------------------------------
39 //----------------------------------------------------------
41 @depends on context && r@
48 //----------------------------------------------------------
50 //----------------------------------------------------------
52 @script:python depends on org@
58 if m.endswith("\\n\""):
59 msg="WARNING avoid newline at end of message in %s" % (fname)
60 msg_safe=msg.replace("[","@(").replace("]",")")
61 coccilib.org.print_todo(p[0], msg_safe)
63 //----------------------------------------------------------
65 //----------------------------------------------------------
67 @script:python depends on report@
73 if m.endswith("\\n\""):
74 msg="WARNING avoid newline at end of message in %s" % (fname)
75 coccilib.report.print_report(p[0], msg)