On Mon, Nov 25, 2024 at 09:18:18AM -0500, Mathieu Desnoyers wrote: > On 2024-11-23 12:38, Linus Torvalds wrote: > I tried the following alteration to the code, which triggers an > unexpected compiler warning on master, but not on v6.12. I suspect > this is something worth discussing: > > static inline void trace_##name(proto) \ > { \ > if (static_branch_unlikely(&__tracepoint_##name.key)) { \ > if (cond) \ > scoped_guard(preempt_notrace) \ > __DO_TRACE_CALL(name, TP_ARGS(args)); \ So coding style would like braces here for it being multi-line. As opposed to C that only mandates it for multi-statement. And then the problem doesn't occur. > } \ > if (IS_ENABLED(CONFIG_LOCKDEP) && (cond)) { \ > WARN_ONCE(!rcu_is_watching(), \ > "RCU not watching for tracepoint"); \ > } \ > } > > I suspect this is caused by the "else" at the end of the __scoped_guard() macro: > > #define __scoped_guard(_name, _label, args...) \ > for (CLASS(_name, scope)(args); \ > __guard_ptr(_name)(&scope) || !__is_cond_ptr(_name); \ > ({ goto _label; })) \ > if (0) { \ > _label: \ > break; \ > } else > > #define scoped_guard(_name, args...) \ > __scoped_guard(_name, __UNIQUE_ID(label), args) > > AFAIU this is a new warning introduced by > > commit fcc22ac5baf ("cleanup: Adjust scoped_guard() macros to avoid potential warning") Yeah,.. So strictly speaking the code is fine, but the various compilers don't like it when that else dangles :/