in https://jfmengels.net/safe-dead-code-removal/ @Jeroen Engels makes a great point about how side effects can make "unused" warnings unreliable
I wonder how dbg and expect should relate to that observation
since they are side effecting when running debug builds, but get removed for --optimize builds
for example, suppose I have a function argument which is only ever used inside a dbg and/or expect - clearly I wouldn't want to get an unused warning for that...that would be annoying; I actually do want it there!
Rather, I'd want it to get silently removed as an unused argument by --optimize (which LLVM should take care of)
I'm wondering if there are other scenarios where we might want to do something different though
can anyone think of any?
I think those are the only ones without introducing more conditional compilation constructs
Last updated: Jun 16 2026 at 16:19 UTC