project-chip / connectedhomeip

Matter (formerly Project CHIP) creates more connections between more objects, simplifying development for manufacturers and increasing compatibility for consumers, guided by the Connectivity Standards Alliance.
https://buildwithmatter.com
Apache License 2.0
7.3k stars 1.95k forks source link

[BUG] Bug found by bugprone-casting-through-void check in .clang-tidy #34008

Open jlatusek opened 2 months ago

jlatusek commented 2 months ago

Reproduction steps

  1. Add bugprone-casting-through-void to .clang-tidy
  2. Open latest build container based on ubuntu:24.04
  3. Run Clang-tidy validation and previous step from build.yaml

Bug prevalence

always

GitHub hash of the SDK that was being used

4cdce52a5fa25542d4fbeb3cdff6e75b3aa1c379

Platform

other

Platform Version(s)

No response

Anything else?

Log file with clang-tidy error: 1_Build on Linux (fake, gcc_release, clang, simulated).txt

bzbarsky-apple commented 2 months ago

@jlatusek Those are all from using the GLib API macros, right? Sounds like we need to add suppressions for those cases or something. That's not code we control.

jlatusek commented 2 months ago

@bzbarsky-apple This error is caused by using glib macros to do the casting. We can try to do the casting another way, but glib macros also check that the object being casted is of the correct type.

bzbarsky-apple commented 2 months ago

Right, so it sounds like we need to suppress the clang-tidy check for these known-safe cases....