diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2020-11-26 06:41:00 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2020-11-27 06:35:20 +0100 |
commit | 1c1729c9be67b00ef0e803ba5a3ce047a721e001 (patch) | |
tree | 60b72890e62fd9fecc6eaf83f65e05fce05668ad /coccinelle | |
parent | network: fix return values (diff) | |
download | systemd-1c1729c9be67b00ef0e803ba5a3ce047a721e001.tar.xz systemd-1c1729c9be67b00ef0e803ba5a3ce047a721e001.zip |
coccinelle: add rules for log_unit_error_errno() or friends
Diffstat (limited to 'coccinelle')
-rw-r--r-- | coccinelle/errno.cocci | 61 | ||||
-rw-r--r-- | coccinelle/synthetic-errno.cocci | 208 |
2 files changed, 269 insertions, 0 deletions
diff --git a/coccinelle/errno.cocci b/coccinelle/errno.cocci index c928266481..4e594e7826 100644 --- a/coccinelle/errno.cocci +++ b/coccinelle/errno.cocci @@ -25,6 +25,13 @@ expression e; - return r; @@ identifier log_LEVEL_errno =~ "^log_(debug|info|notice|warning|error|emergency)_errno$"; +local idexpression r; +@@ ++ return + log_LEVEL_errno(r, ...); +- return r; +@@ +identifier log_LEVEL_errno =~ "^log_(debug|info|notice|warning|error|emergency)_errno$"; expression e; @@ + return @@ -39,3 +46,57 @@ local idexpression r; - log_LEVEL_errno(e, args); - r = e; + r = log_LEVEL_errno(e, args); +@@ +identifier log_UNIT_LEVEL_errno =~ "^log_(unit|link|netdev|device|token)_(debug|info|notice|warning|error|emergency)_errno$"; +local idexpression r; +expression e; +expression u; +@@ +- r = -e; ++ r = + log_UNIT_LEVEL_errno(u, e, ...); +@@ +identifier log_UNIT_LEVEL_errno =~ "^log_(unit|link|netdev|device|token)_(debug|info|notice|warning|error|emergency)_errno$"; +local idexpression r; +expression e; +expression u; +@@ ++ r = + log_UNIT_LEVEL_errno(u, e, ...); +- r = -e; +@@ +identifier log_UNIT_LEVEL_errno =~ "^log_(unit|link|netdev|device|token)_(debug|info|notice|warning|error|emergency)_errno$"; +local idexpression r; +expression e; +expression u; +@@ +- r = ++ return + log_UNIT_LEVEL_errno(u, e, ...); +- return r; +@@ +identifier log_UNIT_LEVEL_errno =~ "^log_(unit|link|netdev|device|token)_(debug|info|notice|warning|error|emergency)_errno$"; +local idexpression r; +expression u; +@@ ++ return + log_UNIT_LEVEL_errno(u, r, ...); +- return r; +@@ +identifier log_UNIT_LEVEL_errno =~ "^log_(unit|link|netdev|device|token)_(debug|info|notice|warning|error|emergency)_errno$"; +expression e; +expression u; +@@ ++ return + log_UNIT_LEVEL_errno(u, e, ...); +- return -e; +@@ +identifier log_UNIT_LEVEL_errno =~ "^log_(unit|link|netdev|device|token)_(debug|info|notice|warning|error|emergency)_errno$"; +expression list args; +expression e; +expression u; +local idexpression r; +@@ +- log_UNIT_LEVEL_errno(u, e, args); +- r = e; ++ r = log_UNIT_LEVEL_errno(u, e, args); diff --git a/coccinelle/synthetic-errno.cocci b/coccinelle/synthetic-errno.cocci index 650c37e08b..3d9af0db21 100644 --- a/coccinelle/synthetic-errno.cocci +++ b/coccinelle/synthetic-errno.cocci @@ -46,3 +46,211 @@ expression list args; @@ - log_LEVEL_errno(ERRNO, args); + log_LEVEL_errno(SYNTHETIC_ERRNO(ERRNO), args); +@@ +identifier log_UNIT_LEVEL_errno =~ "^log_(unit|link|device|token)_(debug|info|notice|warning|error|emergency)_errno$"; +identifier ERRNO =~ "^E[A-Z]+$"; +expression u; +expression list args; +@@ +- log_UNIT_LEVEL_errno(u, ERRNO, args); ++ log_UNIT_LEVEL_errno(u, SYNTHETIC_ERRNO(ERRNO), args); +@@ +expression e; +expression u; +expression list args; +@@ +- log_unit_debug(u, args); +- return -e; ++ return log_unit_debug_errno(u, SYNTHETIC_ERRNO(e), args); +@@ +expression e; +expression u; +expression list args; +@@ +- log_unit_info(u, args); +- return -e; ++ return log_unit_info_errno(u, SYNTHETIC_ERRNO(e), args); +@@ +expression e; +expression u; +expression list args; +@@ +- log_unit_notice(u, args); +- return -e; ++ return log_unit_notice_errno(u, SYNTHETIC_ERRNO(e), args); +@@ +expression e; +expression u; +expression list args; +@@ +- log_unit_error(u, args); +- return -e; ++ return log_unit_error_errno(u, SYNTHETIC_ERRNO(e), args); +@@ +expression e; +expression u; +expression list args; +@@ +- log_unit_emergency(u, args); +- return -e; ++ return log_unit_emergency_errno(u, SYNTHETIC_ERRNO(e), args); +@@ +expression e; +expression u; +expression list args; +@@ +- log_link_debug(u, args); +- return -e; ++ return log_link_debug_errno(u, SYNTHETIC_ERRNO(e), args); +@@ +expression e; +expression u; +expression list args; +@@ +- log_link_info(u, args); +- return -e; ++ return log_link_info_errno(u, SYNTHETIC_ERRNO(e), args); +@@ +expression e; +expression u; +expression list args; +@@ +- log_link_notice(u, args); +- return -e; ++ return log_link_notice_errno(u, SYNTHETIC_ERRNO(e), args); +@@ +expression e; +expression u; +expression list args; +@@ +- log_link_error(u, args); +- return -e; ++ return log_link_error_errno(u, SYNTHETIC_ERRNO(e), args); +@@ +expression e; +expression u; +expression list args; +@@ +- log_link_emergency(u, args); +- return -e; ++ return log_link_emergency_errno(u, SYNTHETIC_ERRNO(e), args); +@@ +expression e; +expression u; +expression list args; +@@ +- log_netdev_debug(u, args); +- return -e; ++ return log_netdev_debug_errno(u, SYNTHETIC_ERRNO(e), args); +@@ +expression e; +expression u; +expression list args; +@@ +- log_netdev_info(u, args); +- return -e; ++ return log_netdev_info_errno(u, SYNTHETIC_ERRNO(e), args); +@@ +expression e; +expression u; +expression list args; +@@ +- log_netdev_notice(u, args); +- return -e; ++ return log_netdev_notice_errno(u, SYNTHETIC_ERRNO(e), args); +@@ +expression e; +expression u; +expression list args; +@@ +- log_netdev_error(u, args); +- return -e; ++ return log_netdev_error_errno(u, SYNTHETIC_ERRNO(e), args); +@@ +expression e; +expression u; +expression list args; +@@ +- log_netdev_emergency(u, args); +- return -e; ++ return log_netdev_emergency_errno(u, SYNTHETIC_ERRNO(e), args); +@@ +expression e; +expression u; +expression list args; +@@ +- log_device_debug(u, args); +- return -e; ++ return log_device_debug_errno(u, SYNTHETIC_ERRNO(e), args); +@@ +expression e; +expression u; +expression list args; +@@ +- log_device_info(u, args); +- return -e; ++ return log_device_info_errno(u, SYNTHETIC_ERRNO(e), args); +@@ +expression e; +expression u; +expression list args; +@@ +- log_device_notice(u, args); +- return -e; ++ return log_device_notice_errno(u, SYNTHETIC_ERRNO(e), args); +@@ +expression e; +expression u; +expression list args; +@@ +- log_device_error(u, args); +- return -e; ++ return log_device_error_errno(u, SYNTHETIC_ERRNO(e), args); +@@ +expression e; +expression u; +expression list args; +@@ +- log_device_emergency(u, args); +- return -e; ++ return log_device_emergency_errno(u, SYNTHETIC_ERRNO(e), args); +@@ +expression e; +expression u; +expression list args; +@@ +- log_token_debug(u, args); +- return -e; ++ return log_token_debug_errno(u, SYNTHETIC_ERRNO(e), args); +@@ +expression e; +expression u; +expression list args; +@@ +- log_token_info(u, args); +- return -e; ++ return log_token_info_errno(u, SYNTHETIC_ERRNO(e), args); +@@ +expression e; +expression u; +expression list args; +@@ +- log_token_notice(u, args); +- return -e; ++ return log_token_notice_errno(u, SYNTHETIC_ERRNO(e), args); +@@ +expression e; +expression u; +expression list args; +@@ +- log_token_error(u, args); +- return -e; ++ return log_token_error_errno(u, SYNTHETIC_ERRNO(e), args); +@@ +expression e; +expression u; +expression list args; +@@ +- log_token_emergency(u, args); +- return -e; ++ return log_token_emergency_errno(u, SYNTHETIC_ERRNO(e), args); |