* [PATCH] smalloc: fix compiler warning
@ 2019-07-31 20:57 vincentfu
2019-07-31 21:17 ` Jens Axboe
2019-07-31 21:28 ` Jens Axboe
0 siblings, 2 replies; 3+ messages in thread
From: vincentfu @ 2019-07-31 20:57 UTC (permalink / raw)
To: axboe, fio; +Cc: Vincent Fu
From: Vincent Fu <vincent.fu@wdc.com>
firstfree() triggers a warning from the Windows compiler used by
AppVeyor because it doesn't return a value if the for loop iterates to
completion. This patch resolves the compiler warning.
AppVeyor Windows build log: https://ci.appveyor.com/project/axboe/fio/builds/26381726
---
smalloc.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/smalloc.c b/smalloc.c
index c97bcbaa..0d7054a4 100644
--- a/smalloc.c
+++ b/smalloc.c
@@ -347,6 +347,9 @@ static unsigned int firstfree(struct pool *pool)
return i;
assert(0);
+
+ /* we will never get here but this fixes a compiler warning */
+ return -1U;
}
static void *__smalloc_pool(struct pool *pool, size_t size)
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] smalloc: fix compiler warning
2019-07-31 20:57 [PATCH] smalloc: fix compiler warning vincentfu
@ 2019-07-31 21:17 ` Jens Axboe
2019-07-31 21:28 ` Jens Axboe
1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2019-07-31 21:17 UTC (permalink / raw)
To: vincentfu, fio; +Cc: Vincent Fu
On 7/31/19 2:57 PM, vincentfu@gmail.com wrote:
> From: Vincent Fu <vincent.fu@wdc.com>
>
> firstfree() triggers a warning from the Windows compiler used by
> AppVeyor because it doesn't return a value if the for loop iterates to
> completion. This patch resolves the compiler warning.
>
> AppVeyor Windows build log: https://ci.appveyor.com/project/axboe/fio/builds/26381726
> ---
> smalloc.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/smalloc.c b/smalloc.c
> index c97bcbaa..0d7054a4 100644
> --- a/smalloc.c
> +++ b/smalloc.c
> @@ -347,6 +347,9 @@ static unsigned int firstfree(struct pool *pool)
> return i;
>
> assert(0);
> +
> + /* we will never get here but this fixes a compiler warning */
> + return -1U;
> }
Thanks, a bit ugly (for Windows), but no big deal.
--
Jens Axboe
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] smalloc: fix compiler warning
2019-07-31 20:57 [PATCH] smalloc: fix compiler warning vincentfu
2019-07-31 21:17 ` Jens Axboe
@ 2019-07-31 21:28 ` Jens Axboe
1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2019-07-31 21:28 UTC (permalink / raw)
To: vincentfu, fio; +Cc: Vincent Fu
On 7/31/19 2:57 PM, vincentfu@gmail.com wrote:
> From: Vincent Fu <vincent.fu@wdc.com>
>
> firstfree() triggers a warning from the Windows compiler used by
> AppVeyor because it doesn't return a value if the for loop iterates to
> completion. This patch resolves the compiler warning.
>
> AppVeyor Windows build log: https://ci.appveyor.com/project/axboe/fio/builds/26381726
I did this on top, as it removes the need to have that weird assert()
with a return. Also fixes the coding style (mix of tabs and spaces), and
makes it easier to read imho. Please review!
http://git.kernel.dk/cgit/fio/commit/?id=21eabccd000aaa36ff8af2cd0db833e0871ed85b
--
Jens Axboe
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-07-31 21:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-31 20:57 [PATCH] smalloc: fix compiler warning vincentfu
2019-07-31 21:17 ` Jens Axboe
2019-07-31 21:28 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox