llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.87k stars 11.93k forks source link

clang-tidy: altera-unroll-loops triggers on do {} while(false) #55436

Open Hedede opened 2 years ago

Hedede commented 2 years ago

Clang 14.0.0 I have a macro like this:

#define GET_ARG(...) do { get_arg_impl(__VA_ARGS__); } while(false)

clang-tidy suggests adding #pragma unroll even though that doesn't make sense because this is a single-iteration loop.

llvmbot commented 2 years ago

@llvm/issue-subscribers-clang-tidy

johnkjellberg commented 11 months ago

I have the same issue with the log macros in Zephyr. I'm surprised that this isn't a bigger issue for people. Is there a easy work around I'm missing?