From 781676f102ff06fd607f95a2ab1ce16edcec46ab Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Tue, 23 Nov 2021 15:06:03 +0300 Subject: [PATCH] clang-format/zdtm: fix clang complains about strange elseifs Clang-format v13 on my Fedora 35 complains about these hunks, more over reading the formating we had before is a pain: } else /* comment */ if (smth) { fail("") return -1; } Let's make explicit {} braces for else, this way it looks much better. Fixes: 93dd984ca ("Run 'make indent' on all C files") Signed-off-by: Pavel Tikhomirov --- test/zdtm/static/mprotect00.c | 16 ++++++++++------ test/zdtm/static/shm-mp.c | 16 ++++++++++------ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/test/zdtm/static/mprotect00.c b/test/zdtm/static/mprotect00.c index 006b64772..717b7ddcf 100644 --- a/test/zdtm/static/mprotect00.c +++ b/test/zdtm/static/mprotect00.c @@ -44,10 +44,12 @@ static int check_prot(char *ptr, int prot) fail("PROT_READ bypassed"); return -1; } - } else /* we come here on return from SIGSEGV handler */ + } else { + /* we come here on return from SIGSEGV handler */ if (prot & PROT_READ) { - fail("PROT_READ rejected"); - return -1; + fail("PROT_READ rejected"); + return -1; + } } if (!sigsetjmp(segv_ret, 1)) { @@ -56,10 +58,12 @@ static int check_prot(char *ptr, int prot) fail("PROT_WRITE bypassed"); return -1; } - } else /* we come here on return from SIGSEGV handler */ + } else { + /* we come here on return from SIGSEGV handler */ if (prot & PROT_WRITE) { - fail("PROT_WRITE rejected"); - return -1; + fail("PROT_WRITE rejected"); + return -1; + } } if (signal(SIGSEGV, SIG_DFL) == SIG_ERR) { diff --git a/test/zdtm/static/shm-mp.c b/test/zdtm/static/shm-mp.c index 1929dac19..c95f3d84c 100644 --- a/test/zdtm/static/shm-mp.c +++ b/test/zdtm/static/shm-mp.c @@ -33,10 +33,12 @@ static int check_prot(char *ptr, char val, int prot) fail("PROT_READ bypassed"); return -1; } - } else /* we come here on return from SIGSEGV handler */ + } else { + /* we come here on return from SIGSEGV handler */ if (prot & PROT_READ) { - fail("PROT_READ rejected"); - return -1; + fail("PROT_READ rejected"); + return -1; + } } if (!sigsetjmp(segv_ret, 1)) { @@ -45,10 +47,12 @@ static int check_prot(char *ptr, char val, int prot) fail("PROT_WRITE bypassed"); return -1; } - } else /* we come here on return from SIGSEGV handler */ + } else { + /* we come here on return from SIGSEGV handler */ if (prot & PROT_WRITE) { - fail("PROT_WRITE rejected"); - return -1; + fail("PROT_WRITE rejected"); + return -1; + } } if (signal(SIGSEGV, SIG_DFL) == SIG_ERR) {