DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [DPDK/ethdev Bug 1986] dpaax: build warnings with clang-23
@ 2026-08-24 15:56 bugzilla
  0 siblings, 0 replies; only message in thread
From: bugzilla @ 2026-08-24 15:56 UTC (permalink / raw)
  To: dev

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.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-24 15:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-24 15:56 [DPDK/ethdev Bug 1986] dpaax: build warnings with clang-23 bugzilla

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox