All of lore.kernel.org
 help / color / mirror / Atom feed
From: bugzilla@dpdk.org
To: dev@dpdk.org
Subject: [DPDK/ethdev Bug 1986] dpaax: build warnings with clang-23
Date: Mon, 24 Aug 2026 15:56:09 +0000	[thread overview]
Message-ID: <bug-1986-3@https.bugs.dpdk.org/> (raw)

https://bugs.dpdk.org/show_bug.cgi?id=1986

            Bug ID: 1986
           Summary: dpaax: build warnings with clang-23
           Product: DPDK
           Version: 26.11
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: minor
          Priority: Normal
         Component: ethdev
          Assignee: dev@dpdk.org
          Reporter: stephen@networkplumber.org
  Target Milestone: ---

Clang 23 checks for set but not used global variables.



  ../drivers/common/dpaax/dpaa_of.c:14:12: error: variable 'alive' set but not
used
     [-Werror,-Wunused-but-set-global]
     14 | static int alive;
        |            ^

  clang-23 extends -Wunused-but-set-variable to file-scope statics
  (-Wunused-but-set-global), which is enabled by -Wall and fatal under -Werror.
  Earlier clang and GCC releases do not diagnose this case, so the code builds
  there.


  alive is assigned in of_init_path() and of_finish(), and is otherwise
referenced
  only as the condition argument to DPAAX_HWWARN(), at 13 call sites in
dpaa_of.c.
  That macro is defined in drivers/common/dpaax/dpaax_logs.h:

  #ifdef RTE_LIBRTE_DPAAX_DEBUG
  #define DPAAX_HWWARN(cond, fmt, ...) \
        do {\
                if (cond) \
                        DPAAX_LOG(DEBUG, "WARN: " fmt, ##__VA_ARGS__); \
        } while (0)
  #else
  #define DPAAX_HWWARN(cond, fmt, ...) do { } while (0)
  #endif

  The disabled variant discards cond entirely, so alive is never read — hence
the
  warning.

There are three options:
1. Remove all this code, since RTE_LIBRTE_DPAAX_DEBUG is not defined anywhere
and there is no meson build to set it. I.e dead code.

2. Add 0 to the do { } while() like:

#ifdef RTE_LIBRTE_DPAAX_DEBUG
#define DPAAX_HWWARN(cond, fmt, ...) \
        do {\
                if (cond) \
                        DPAAX_LOG(DEBUG, "WARN: " fmt, ##__VA_ARGS__); \
        } while (0)
#else
#define DPAAX_HWWARN(cond, fmt, ...) \
        do {\
                if (0 && (cond)) \
                        break; \
        } while (0)
#endif

3. Cleanup and keep the check.
Rename the variable because 'alive' is not descriptive.
Always do the check (no #ifdef) since it is good bug trap.
Make it a warning or notice level since buggy device tree is worth checking.

That would end up renaming or removing macro.

-- 
You are receiving this mail because:
You are the assignee for the bug.

                 reply	other threads:[~2026-08-24 15:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-1986-3@https.bugs.dpdk.org/ \
    --to=bugzilla@dpdk.org \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.