* [PATCH] zstd: Fix definition of assert()
@ 2023-01-29 13:14 Jonathan Neuschäfer
2023-03-03 6:51 ` Nick Terrell
0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Neuschäfer @ 2023-01-29 13:14 UTC (permalink / raw)
To: Nick Terrell; +Cc: Jonathan Neuschäfer, linux-kernel
assert(x) should emit a warning if x is false. WARN_ON(x) emits a
warning if x is true. Thus, assert(x) should be defined as WARN_ON(!x)
rather than WARN_ON(x).
Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
---
Commit e0c1b49f5b674 ("lib: zstd: Upgrade to latest upstream zstd
version 1.4.10") mentions that the zstd code was generated from the
upstream version of zstd, so perhaps the definition of assert based on
WARN_ON should be fixed in the conversion script and/or upstream zstd
source code.
---
lib/zstd/common/zstd_deps.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/zstd/common/zstd_deps.h b/lib/zstd/common/zstd_deps.h
index 7a5bf44839c9c..f06df065dec01 100644
--- a/lib/zstd/common/zstd_deps.h
+++ b/lib/zstd/common/zstd_deps.h
@@ -84,7 +84,7 @@ static uint64_t ZSTD_div64(uint64_t dividend, uint32_t divisor) {
#include <linux/kernel.h>
-#define assert(x) WARN_ON((x))
+#define assert(x) WARN_ON(!(x))
#endif /* ZSTD_DEPS_ASSERT */
#endif /* ZSTD_DEPS_NEED_ASSERT */
--
2.39.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] zstd: Fix definition of assert()
@ 2023-03-03 6:51 ` Nick Terrell
0 siblings, 0 replies; 4+ messages in thread
From: Nick Terrell @ 2023-03-03 6:30 UTC (permalink / raw)
To: Jonathan Neuschäfer; +Cc: Nick Terrell, Nick Terrell, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1941 bytes --]
> On Jan 29, 2023, at 5:14 AM, Jonathan Neuschäfer <j.neuschaefer@gmx.net> wrote:
>
> !-------------------------------------------------------------------|
> This Message Is From an External Sender
>
> |-------------------------------------------------------------------!
>
> assert(x) should emit a warning if x is false. WARN_ON(x) emits a
> warning if x is true. Thus, assert(x) should be defined as WARN_ON(!x)
> rather than WARN_ON(x).
>
> Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
Hi Jonathan,
I have to apologize, I just submitted my branch for a PR and I realize that
while I intended to take your patch, I took a different equivalent patch. So
I wanted to say thanks for sending the patch!
> ---
>
> Commit e0c1b49f5b674 ("lib: zstd: Upgrade to latest upstream zstd
> version 1.4.10") mentions that the zstd code was generated from the
> upstream version of zstd, so perhaps the definition of assert based on
> WARN_ON should be fixed in the conversion script and/or upstream zstd
> source code.
Yeah, we need to fix it upstream, so if you would like to submit the upstream PR
the file is contrib/linux-kernel/zstd_deps.h [0]. Otherwise, I will update it before
the next import.
Best,
Nick Terrell
[0] https://github.com/facebook/zstd/blob/dev/contrib/linux-kernel/zstd_deps.h
> ---
> lib/zstd/common/zstd_deps.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/zstd/common/zstd_deps.h b/lib/zstd/common/zstd_deps.h
> index 7a5bf44839c9c..f06df065dec01 100644
> --- a/lib/zstd/common/zstd_deps.h
> +++ b/lib/zstd/common/zstd_deps.h
> @@ -84,7 +84,7 @@ static uint64_t ZSTD_div64(uint64_t dividend, uint32_t divisor) {
>
> #include <linux/kernel.h>
>
> -#define assert(x) WARN_ON((x))
> +#define assert(x) WARN_ON(!(x))
>
> #endif /* ZSTD_DEPS_ASSERT */
> #endif /* ZSTD_DEPS_NEED_ASSERT */
> --
> 2.39.0
>
[-- Attachment #2: winmail.dat --]
[-- Type: application/ms-tnef, Size: 13697 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] zstd: Fix definition of assert()
@ 2023-03-03 6:51 ` Nick Terrell
0 siblings, 0 replies; 4+ messages in thread
From: Nick Terrell @ 2023-03-03 6:51 UTC (permalink / raw)
To: Jonathan Neuschäfer; +Cc: Nick Terrell, Nick Terrell, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1941 bytes --]
> On Jan 29, 2023, at 5:14 AM, Jonathan Neuschäfer <j.neuschaefer@gmx.net> wrote:
>
> !-------------------------------------------------------------------|
> This Message Is From an External Sender
>
> |-------------------------------------------------------------------!
>
> assert(x) should emit a warning if x is false. WARN_ON(x) emits a
> warning if x is true. Thus, assert(x) should be defined as WARN_ON(!x)
> rather than WARN_ON(x).
>
> Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
Hi Jonathan,
I have to apologize, I just submitted my branch for a PR and I realize that
while I intended to take your patch, I took a different equivalent patch. So
I wanted to say thanks for sending the patch!
> ---
>
> Commit e0c1b49f5b674 ("lib: zstd: Upgrade to latest upstream zstd
> version 1.4.10") mentions that the zstd code was generated from the
> upstream version of zstd, so perhaps the definition of assert based on
> WARN_ON should be fixed in the conversion script and/or upstream zstd
> source code.
Yeah, we need to fix it upstream, so if you would like to submit the upstream PR
the file is contrib/linux-kernel/zstd_deps.h [0]. Otherwise, I will update it before
the next import.
Best,
Nick Terrell
[0] https://github.com/facebook/zstd/blob/dev/contrib/linux-kernel/zstd_deps.h
> ---
> lib/zstd/common/zstd_deps.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/zstd/common/zstd_deps.h b/lib/zstd/common/zstd_deps.h
> index 7a5bf44839c9c..f06df065dec01 100644
> --- a/lib/zstd/common/zstd_deps.h
> +++ b/lib/zstd/common/zstd_deps.h
> @@ -84,7 +84,7 @@ static uint64_t ZSTD_div64(uint64_t dividend, uint32_t divisor) {
>
> #include <linux/kernel.h>
>
> -#define assert(x) WARN_ON((x))
> +#define assert(x) WARN_ON(!(x))
>
> #endif /* ZSTD_DEPS_ASSERT */
> #endif /* ZSTD_DEPS_NEED_ASSERT */
> --
> 2.39.0
>
[-- Attachment #2: winmail.dat --]
[-- Type: application/ms-tnef, Size: 13705 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] zstd: Fix definition of assert()
2023-03-03 6:51 ` Nick Terrell
(?)
@ 2023-03-03 14:27 ` Jonathan Neuschäfer
-1 siblings, 0 replies; 4+ messages in thread
From: Jonathan Neuschäfer @ 2023-03-03 14:27 UTC (permalink / raw)
To: Nick Terrell; +Cc: Jonathan Neuschäfer, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1326 bytes --]
On Fri, Mar 03, 2023 at 06:30:47AM +0000, Nick Terrell wrote:
> On Jan 29, 2023, at 5:14 AM, Jonathan Neuschäfer <j.neuschaefer@gmx.net> wrote:
> >
> > assert(x) should emit a warning if x is false. WARN_ON(x) emits a
> > warning if x is true. Thus, assert(x) should be defined as WARN_ON(!x)
> > rather than WARN_ON(x).
> >
> > Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
>
> Hi Jonathan,
>
> I have to apologize, I just submitted my branch for a PR and I realize that
> while I intended to take your patch, I took a different equivalent patch. So
> I wanted to say thanks for sending the patch!
No problem at all, and thanks for informing me!
>
> > ---
> >
> > Commit e0c1b49f5b674 ("lib: zstd: Upgrade to latest upstream zstd
> > version 1.4.10") mentions that the zstd code was generated from the
> > upstream version of zstd, so perhaps the definition of assert based on
> > WARN_ON should be fixed in the conversion script and/or upstream zstd
> > source code.
>
> Yeah, we need to fix it upstream, so if you would like to submit the upstream PR
> the file is contrib/linux-kernel/zstd_deps.h [0]. Otherwise, I will update it before
> the next import.
Feel free to do it yourself, as I haven't been involed with zstd
developement so far.
Thanks,
Jonathan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-03-03 14:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-29 13:14 [PATCH] zstd: Fix definition of assert() Jonathan Neuschäfer
2023-03-03 6:30 ` Nick Terrell
2023-03-03 6:51 ` Nick Terrell
2023-03-03 14:27 ` Jonathan Neuschäfer
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.