From d4ae0b77f9ff0380e9766d1a4e0301b1d1521da3 Mon Sep 17 00:00:00 2001
From: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Date: Tue, 23 Nov 2021 15:06:03 +0300
Subject: [PATCH 049/120] 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 <ptikhomirov@virtuozzo.com>
---
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) {
--
2.34.1