On Thu, May 9, 2024 at 1:47 AM Jose E. Marchesi <jose.marchesi@xxxxxxxxxx> wrote: > +/* A `break' executed in the head of a `for' loop statement is bound > + to the current loop in clang, but it is bound to the enclosing loop > + in GCC. Note both compilers optimize the outer loop out with -O1 > + and higher. This macro shall be used to annotate any loop that > + uses cond_break within its header. */ > +#ifdef __clang__ > +#define __compat_break > +#else > +#define __compat_break for (int __control = 1; __control; --__control) > +#endif .. > + __compat_break > for (i = zero; i < cnt; cond_break, i++) { > struct elem __arena *n = bpf_alloc(sizeof(*n)); This is too ugly. It ruins the readability of the code. Let's introduce can_loop macro similar to cond_break that returns 0 or 1 instead of break/continue and use it as: for (i = zero; i < cnt && can_loop; i++) { pw-bot: cr