Re: git: 56f3f2d2491e - main - libsecureboot: avoid set but not used errors

From: Rob Wing <rob.fx907_at_gmail.com>
Date: Fri, 30 Jun 2023 21:52:37 UTC
Looking at this snippet:

+       if (!cn.status) {
                buf = NULL;
+               if (err == 0)           /* keep compiler happy */
+                       buf = NULL;
+       }
        return (buf);
 }

And considering the comment at contrib/bearssl/inc/bearssl_x509.h
<https://github.com/freebsd/freebsd-src/blob/eb33b693b364a4547dfcfd21c159ffc4fb339bc2/contrib/bearssl/inc/bearssl_x509.h#L616>,
is it intended for buf to be returned as-is (i.e., not set to NULL) when
the decoding status indicates an error condition?


On Fri, Jun 30, 2023 at 1:14 PM Simon J. Gerraty <sjg@juniper.net> wrote:

> Jessica Clarke <jrtc27@freebsd.org> wrote:
> > A conditional assignment of the same value that has already been
> > assigned unconditionally is unidiomatic code generally regarded as a
> > code smell and should be avoided. In an ideal world that would give a
>
> I agree.
>
> I've been bitten by __unused recently when porting stuff to linux
> so was looking to avoid that.
>
>