From: Willy Tarreau Date: Tue, 11 Aug 2026 07:32:02 +0000 (+0200) Subject: MINOR: debug: avoid the break in __BUG_ON() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4d67a9e7f0e2781246489b7724e0d379f191340e;p=thirdparty%2Fhaproxy.git MINOR: debug: avoid the break in __BUG_ON() Since the "break" statement irritates gcc, let's resort to the opposite expression involving a compount expression to declare the static counter. It seems to be doing the job well, and we're back to the previous size (-63 kB from original). --- diff --git a/include/haproxy/bug.h b/include/haproxy/bug.h index efabaab5f..20d6bd22c 100644 --- a/include/haproxy/bug.h +++ b/include/haproxy/bug.h @@ -416,16 +416,15 @@ extern __attribute__((__weak__)) struct debug_count __stop_dbg_cnt HA_SECTION_S msg = "\"" #cond "\" matched at " file ":" #line "\x1e" __VA_ARGS__; \ else \ msg = "\"" #cond "\" matched at " file ":" #line; \ - if (type == DBG_BUG_ONCE) { \ - static int __match_count_##line; \ - if (_HA_ATOMIC_FETCH_ADD(&__match_count_##line, 1)) \ - break; \ - } \ - complain(details, msg); \ - if (details & DBG_DET_FAT_FATL) \ - ABORT_NOW(); \ - else if (details & DBG_DET_FAT_WARN) \ - ha_backtrace_to_stderr(0); \ + if (type != DBG_BUG_ONCE || \ + ({ static int __match_count_##line; \ + !_HA_ATOMIC_FETCH_ADD(&__match_count_##line, 1); })) { \ + complain(details, msg); \ + if (details & DBG_DET_FAT_FATL) \ + ABORT_NOW(); \ + else if (details & DBG_DET_FAT_WARN) \ + ha_backtrace_to_stderr(0); \ + } \ } while (0) /* This one is equivalent except that it only emits the message once by