Message ID | 20250128163859.1883260-2-agruenba@redhat.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | bcachefs: eytzinger code | expand |
Hello Andreas, On 2025-01-28 17:38, Andreas Gruenbacher wrote: > This statement does nothing. I would suggest this statement does nothing only in the case of #ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS. In the case where CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS _is_ defined, it tells the compiler that it should not emit a warning for an unused parameter. Perhaps it should be moved in to an #else of the #ifndef in order to more clearly communicate that it is expected and okay to ignore this parameter in this case. Cheers, -Eric > > Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> > --- > fs/bcachefs/eytzinger.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/fs/bcachefs/eytzinger.c b/fs/bcachefs/eytzinger.c > index 2eaffe37b5e7..c0fdfe909cf2 100644 > --- a/fs/bcachefs/eytzinger.c > +++ b/fs/bcachefs/eytzinger.c > @@ -20,7 +20,6 @@ static bool is_aligned(const void *base, size_t size, unsigned char align) > { > unsigned char lsbits = (unsigned char)size; > > - (void)base; > #ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS > lsbits |= (unsigned char)(uintptr_t)base; > #endif
On Wed, Jan 29, 2025 at 11:32 AM Eric Herman <eric@commonscaretakers.com> wrote: > Hello Andreas, > > On 2025-01-28 17:38, Andreas Gruenbacher wrote: > > This statement does nothing. > > I would suggest this statement does nothing only in the case of #ifndef > CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS. > > In the case where CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS _is_ defined, > it tells the compiler that it should not emit a warning for an unused > parameter. > > Perhaps it should be moved in to an #else of the #ifndef in order to > more clearly communicate that it is expected and okay to ignore this > parameter in this case. How about declaring base __maybe_unused? Thanks, Andreas > Cheers, > -Eric > > > > > Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> > > --- > > fs/bcachefs/eytzinger.c | 1 - > > 1 file changed, 1 deletion(-) > > > > diff --git a/fs/bcachefs/eytzinger.c b/fs/bcachefs/eytzinger.c > > index 2eaffe37b5e7..c0fdfe909cf2 100644 > > --- a/fs/bcachefs/eytzinger.c > > +++ b/fs/bcachefs/eytzinger.c > > @@ -20,7 +20,6 @@ static bool is_aligned(const void *base, size_t size, unsigned char align) > > { > > unsigned char lsbits = (unsigned char)size; > > > > - (void)base; > > #ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS > > lsbits |= (unsigned char)(uintptr_t)base; > > #endif >
Hello Andreas, On 2025-01-29 14:19, Andreas Gruenbacher wrote: > On Wed, Jan 29, 2025 at 11:32 AM Eric Herman <eric@commonscaretakers.com> wrote: >> Hello Andreas, >> >> On 2025-01-28 17:38, Andreas Gruenbacher wrote: >>> This statement does nothing. >> I would suggest this statement does nothing only in the case of #ifndef >> CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS. >> >> In the case where CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS _is_ defined, >> it tells the compiler that it should not emit a warning for an unused >> parameter. >> >> Perhaps it should be moved in to an #else of the #ifndef in order to >> more clearly communicate that it is expected and okay to ignore this >> parameter in this case. > How about declaring base __maybe_unused? Yes, that would be better. Cheers, -Eric > > Thanks, > Andreas > >> Cheers, >> -Eric >> >>> Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> >>> --- >>> fs/bcachefs/eytzinger.c | 1 - >>> 1 file changed, 1 deletion(-) >>> >>> diff --git a/fs/bcachefs/eytzinger.c b/fs/bcachefs/eytzinger.c >>> index 2eaffe37b5e7..c0fdfe909cf2 100644 >>> --- a/fs/bcachefs/eytzinger.c >>> +++ b/fs/bcachefs/eytzinger.c >>> @@ -20,7 +20,6 @@ static bool is_aligned(const void *base, size_t size, unsigned char align) >>> { >>> unsigned char lsbits = (unsigned char)size; >>> >>> - (void)base; >>> #ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS >>> lsbits |= (unsigned char)(uintptr_t)base; >>> #endif
diff --git a/fs/bcachefs/eytzinger.c b/fs/bcachefs/eytzinger.c index 2eaffe37b5e7..c0fdfe909cf2 100644 --- a/fs/bcachefs/eytzinger.c +++ b/fs/bcachefs/eytzinger.c @@ -20,7 +20,6 @@ static bool is_aligned(const void *base, size_t size, unsigned char align) { unsigned char lsbits = (unsigned char)size; - (void)base; #ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS lsbits |= (unsigned char)(uintptr_t)base; #endif
This statement does nothing. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> --- fs/bcachefs/eytzinger.c | 1 - 1 file changed, 1 deletion(-)