diff mbox

[01/26] coccinelle: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)

Message ID 1474034177-17663-2-git-send-email-lvivier@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Laurent Vivier Sept. 16, 2016, 1:55 p.m. UTC
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
 scripts/coccinelle/exit.cocci | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 scripts/coccinelle/exit.cocci

Comments

Eric Blake Sept. 16, 2016, 3:35 p.m. UTC | #1
On 09/16/2016 08:55 AM, Laurent Vivier wrote:
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---
>  scripts/coccinelle/exit.cocci | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>  create mode 100644 scripts/coccinelle/exit.cocci
> 

Script itself is fine. Whether to apply it throughout the tree is a
cosmetic question, but I'm in favor of it; and the script will help us
keep the tree clean. Do we need/want to update HACKING to mention our
new enforced style as well, later in the series?

Reviewed-by: Eric Blake <eblake@redhat.com>

However, Coccinelle doesn't seem to catch comments; your series has
missed at least the 'exit(1)' in the comments of include/qapi/error.h.

> diff --git a/scripts/coccinelle/exit.cocci b/scripts/coccinelle/exit.cocci
> new file mode 100644
> index 0000000..73386c0
> --- /dev/null
> +++ b/scripts/coccinelle/exit.cocci
> @@ -0,0 +1,12 @@
> +// replace exit(0) by exit(EXIT_SUCCESS)
> +//         exit(1) by exit(EXIT_FAILURE)
> +
> +@@
> +@@
> +(
> +- exit(0)
> ++ exit(EXIT_SUCCESS)
> +|
> +- exit(1)
> ++ exit(EXIT_FAILURE)
> +)
>
diff mbox

Patch

diff --git a/scripts/coccinelle/exit.cocci b/scripts/coccinelle/exit.cocci
new file mode 100644
index 0000000..73386c0
--- /dev/null
+++ b/scripts/coccinelle/exit.cocci
@@ -0,0 +1,12 @@ 
+// replace exit(0) by exit(EXIT_SUCCESS)
+//         exit(1) by exit(EXIT_FAILURE)
+
+@@
+@@
+(
+- exit(0)
++ exit(EXIT_SUCCESS)
+|
+- exit(1)
++ exit(EXIT_FAILURE)
+)