* [PATCH v3 0/3] Small fio cleanups and fixes
@ 2022-04-28 20:39 Ammar Faizi
2022-04-28 20:39 ` [PATCH v3 1/3] backend: Fix indentation Ammar Faizi
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Ammar Faizi @ 2022-04-28 20:39 UTC (permalink / raw)
To: Jens Axboe
Cc: Ammar Faizi, Niklas Cassel, fio Mailing List,
GNU/Weeb Mailing List
From: Ammar Faizi <[email protected]>
Hi Jens,
This is the v3 series of small fio cleanups and fixes. I dropped
the patches about ENOMEM handling this time. I will resend those
in a different series later because I think we have many places
to fix them, so I will dedicate more time to it.
There are 3 patches in this series:
1. Trivial indentation fix.
2. Small optimization for the JSON code.
3. Fix `-Wimplicit-fallthrough` warning when compiling with clang-15.
Please review, thanks!
Signed-off-by: Ammar Faizi <[email protected]>
---
Ammar Faizi (3):
backend: Fix indentation
json: Change `if (!strlen(str))` to `if (!str[0])`
Makefile: Suppress `-Wimplicit-fallthrough` when compiling `lex.yy`
Makefile | 6 +++++-
backend.c | 2 +-
json.c | 2 +-
3 files changed, 7 insertions(+), 3 deletions(-)
base-commit: 5f2d43188c2d65674aaba6280e2a87107e5d7099
--
Ammar Faizi
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v3 1/3] backend: Fix indentation
2022-04-28 20:39 [PATCH v3 0/3] Small fio cleanups and fixes Ammar Faizi
@ 2022-04-28 20:39 ` Ammar Faizi
2022-04-28 20:39 ` [PATCH v3 2/3] json: Change `if (!strlen(str))` to `if (!str[0])` Ammar Faizi
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Ammar Faizi @ 2022-04-28 20:39 UTC (permalink / raw)
To: Jens Axboe
Cc: Ammar Faizi, Niklas Cassel, fio Mailing List,
GNU/Weeb Mailing List
From: Ammar Faizi <[email protected]>
Signed-off-by: Ammar Faizi <[email protected]>
---
backend.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/backend.c b/backend.c
index 317e4f6c..071fd1d1 100644
--- a/backend.c
+++ b/backend.c
@@ -2021,7 +2021,7 @@ static void reap_threads(unsigned int *nr_running, uint64_t *t_rate,
for_each_td(td, i) {
int flags = 0;
- if (!strcmp(td->o.ioengine, "cpuio"))
+ if (!strcmp(td->o.ioengine, "cpuio"))
cputhreads++;
else
realthreads++;
--
Ammar Faizi
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v3 2/3] json: Change `if (!strlen(str))` to `if (!str[0])`
2022-04-28 20:39 [PATCH v3 0/3] Small fio cleanups and fixes Ammar Faizi
2022-04-28 20:39 ` [PATCH v3 1/3] backend: Fix indentation Ammar Faizi
@ 2022-04-28 20:39 ` Ammar Faizi
2022-04-28 20:39 ` [PATCH v3 3/3] Makefile: Suppress `-Wimplicit-fallthrough` when compiling `lex.yy` Ammar Faizi
2022-04-29 7:46 ` [PATCH v3 0/3] Small fio cleanups and fixes Niklas Cassel
3 siblings, 0 replies; 5+ messages in thread
From: Ammar Faizi @ 2022-04-28 20:39 UTC (permalink / raw)
To: Jens Axboe
Cc: Ammar Faizi, Niklas Cassel, fio Mailing List,
GNU/Weeb Mailing List
From: Ammar Faizi <[email protected]>
No need to traverse the whole string. Using `!strlen(str)` as a
*conditional expression* is effectively the same with `!str[0]`.
Signed-off-by: Ammar Faizi <[email protected]>
---
json.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/json.c b/json.c
index cd3d5d74..8b650721 100644
--- a/json.c
+++ b/json.c
@@ -56,7 +56,7 @@ static char *strdup_escape(const char *str)
char *p, *ret;
int escapes;
- if (!strlen(str))
+ if (!str[0])
return NULL;
escapes = 0;
--
Ammar Faizi
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v3 3/3] Makefile: Suppress `-Wimplicit-fallthrough` when compiling `lex.yy`
2022-04-28 20:39 [PATCH v3 0/3] Small fio cleanups and fixes Ammar Faizi
2022-04-28 20:39 ` [PATCH v3 1/3] backend: Fix indentation Ammar Faizi
2022-04-28 20:39 ` [PATCH v3 2/3] json: Change `if (!strlen(str))` to `if (!str[0])` Ammar Faizi
@ 2022-04-28 20:39 ` Ammar Faizi
2022-04-29 7:46 ` [PATCH v3 0/3] Small fio cleanups and fixes Niklas Cassel
3 siblings, 0 replies; 5+ messages in thread
From: Ammar Faizi @ 2022-04-28 20:39 UTC (permalink / raw)
To: Jens Axboe
Cc: Ammar Faizi, Niklas Cassel, fio Mailing List,
GNU/Weeb Mailing List
From: Ammar Faizi <[email protected]>
lex.yy.c is an auto generated C file. When compiling with clang-15, we
got the following warning:
```
CC lex.yy.o
lex.yy.c:1444:5: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
case EOB_ACT_END_OF_FILE:
^
lex.yy.c:1444:5: note: insert '__attribute__((fallthrough));' to silence this warning
case EOB_ACT_END_OF_FILE:
^
__attribute__((fallthrough));
lex.yy.c:1444:5: note: insert 'break;' to avoid fall-through
case EOB_ACT_END_OF_FILE:
^
break;
1 warning generated.
```
There is nothing we can do to fix lex.yy.c since it's an auto generated
file. Fix this by appending `-Wno-implicit-fallthrough` when compiling
this file if we have `-Wimplicit-fallthrough` flag enabled.
Signed-off-by: Ammar Faizi <[email protected]>
---
Makefile | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index e670c1f2..1e15a69e 100644
--- a/Makefile
+++ b/Makefile
@@ -530,8 +530,12 @@ else
$(QUIET_LEX)$(LEX) $<
endif
+ifneq (,$(findstring -Wimplicit-fallthrough,$(CFLAGS)))
+LEX_YY_CFLAGS := -Wno-implicit-fallthrough
+endif
+
lex.yy.o: lex.yy.c y.tab.h
- $(QUIET_CC)$(CC) -o $@ $(CFLAGS) $(CPPFLAGS) -c $<
+ $(QUIET_CC)$(CC) -o $@ $(CFLAGS) $(CPPFLAGS) $(LEX_YY_CFLAGS) -c $<
y.tab.o: y.tab.c y.tab.h
$(QUIET_CC)$(CC) -o $@ $(CFLAGS) $(CPPFLAGS) -c $<
--
Ammar Faizi
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v3 0/3] Small fio cleanups and fixes
2022-04-28 20:39 [PATCH v3 0/3] Small fio cleanups and fixes Ammar Faizi
` (2 preceding siblings ...)
2022-04-28 20:39 ` [PATCH v3 3/3] Makefile: Suppress `-Wimplicit-fallthrough` when compiling `lex.yy` Ammar Faizi
@ 2022-04-29 7:46 ` Niklas Cassel
3 siblings, 0 replies; 5+ messages in thread
From: Niklas Cassel @ 2022-04-29 7:46 UTC (permalink / raw)
To: Ammar Faizi; +Cc: Jens Axboe, fio Mailing List, GNU/Weeb Mailing List
On Fri, Apr 29, 2022 at 03:39:51AM +0700, Ammar Faizi wrote:
> From: Ammar Faizi <[email protected]>
>
> Hi Jens,
>
> This is the v3 series of small fio cleanups and fixes. I dropped
> the patches about ENOMEM handling this time. I will resend those
> in a different series later because I think we have many places
> to fix them, so I will dedicate more time to it.
>
> There are 3 patches in this series:
>
> 1. Trivial indentation fix.
> 2. Small optimization for the JSON code.
> 3. Fix `-Wimplicit-fallthrough` warning when compiling with clang-15.
>
> Please review, thanks!
>
> Signed-off-by: Ammar Faizi <[email protected]>
> ---
>
> Ammar Faizi (3):
> backend: Fix indentation
> json: Change `if (!strlen(str))` to `if (!str[0])`
> Makefile: Suppress `-Wimplicit-fallthrough` when compiling `lex.yy`
>
> Makefile | 6 +++++-
> backend.c | 2 +-
> json.c | 2 +-
> 3 files changed, 7 insertions(+), 3 deletions(-)
>
>
> base-commit: 5f2d43188c2d65674aaba6280e2a87107e5d7099
> --
> Ammar Faizi
>
For the series:
Reviewed-by: Niklas Cassel <[email protected]>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-04-29 7:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-28 20:39 [PATCH v3 0/3] Small fio cleanups and fixes Ammar Faizi
2022-04-28 20:39 ` [PATCH v3 1/3] backend: Fix indentation Ammar Faizi
2022-04-28 20:39 ` [PATCH v3 2/3] json: Change `if (!strlen(str))` to `if (!str[0])` Ammar Faizi
2022-04-28 20:39 ` [PATCH v3 3/3] Makefile: Suppress `-Wimplicit-fallthrough` when compiling `lex.yy` Ammar Faizi
2022-04-29 7:46 ` [PATCH v3 0/3] Small fio cleanups and fixes Niklas Cassel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox