Skip to content

LOG_ macros cause codechecker "conditional operator with identical true and false expressions" violation #93824

@stgloorious

Description

@stgloorious

Describe the bug

We use codechecker with twister by setting ZEPHYR_SCA_VARIANT=codechecker. This worked fine with Zephyr 4.1.0, but yields the following warning in 4.2.0:

    "type": "issue",
    "check_name": "bugprone-branch-clone",
    "description": "conditional operator with identical true and false expressions",
    "categories": [
      "Bug Risk"
    ],
    "severity": "minor"

In #87461, this compiler trick was introduced:

#define Z_ARGIFY(arg) ((0) ? (arg) : (arg))

which causes the codechecker issue.

Regression

  • This is a regression.
    1ac19d3e98116154654a9467f8864fb2f2b4c10d

Steps to reproduce

Build a project that uses e.g., LOG_ERR("...")

Relevant log output

Impact

Annoyance – Minor irritation; no significant impact on usability or functionality.

Environment

No response

Additional Context

No response

Metadata

Metadata

Assignees

Labels

area: LoggingbugThe issue is a bug, or the PR is fixing a bugpriority: lowLow impact/importance bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions