From: Willy Tarreau Date: Mon, 10 Aug 2026 15:32:57 +0000 (+0200) Subject: CLEANUP: debug: remove the now unused counter argument to complain() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8f8cca5f0ea838d5cfc7dc8ab4cecb57fcb001c0;p=thirdparty%2Fhaproxy.git CLEANUP: debug: remove the now unused counter argument to complain() Let's drop it before someone has the idea to use it again. We take this opportunity for swapping complain()'s arguments which were really poorly ordered since we're really passing a context first, so the calls read better this way, particularly since we plan to add more. This drops another 4 kB of code due to the number of calls. --- diff --git a/include/haproxy/bug.h b/include/haproxy/bug.h index 6e2968871..5b408db23 100644 --- a/include/haproxy/bug.h +++ b/include/haproxy/bug.h @@ -168,7 +168,7 @@ struct debug_count { #endif /* report a bug on stderr */ -void complain(int *counter, const char *msg, uint details); +void complain(uint details, const char *msg); void ha_backtrace_to_stderr(int hint); /* Let's make DEBUG_STRESS equal to zero if not set or not valid, or to @@ -301,7 +301,7 @@ static __attribute__((noinline,noreturn,unused)) void abort_with_line(uint line) #define __ABORT_NOW(file, line, ...) do { \ if (sizeof("" __VA_ARGS__) > 1) \ - complain(NULL, "\nABORT at " file ":" #line ": " __VA_ARGS__ "\n", DBG_FATL_ABT); \ + complain(DBG_FATL_ABT, "\nABORT at " file ":" #line ": " __VA_ARGS__ "\n"); \ ha_backtrace_to_stderr(1); \ abort_with_line(__LINE__); \ } while (0) @@ -414,7 +414,7 @@ extern __attribute__((__weak__)) struct debug_count __stop_dbg_cnt HA_SECTION_S msg ="\n" pfx "condition \"" #cond "\" matched at " file ":" #line "" sfx "\n" __VA_ARGS__ "\n"; \ else \ msg = "\n" pfx "condition \"" #cond "\" matched at " file ":" #line "" sfx "\n"; \ - complain(NULL, msg, details); \ + complain(details, msg); \ if (details & DBG_DET_FAT_FATL) \ ABORT_NOW(); \ else if (details & DBG_DET_FAT_WARN) \ @@ -442,7 +442,7 @@ extern __attribute__((__weak__)) struct debug_count __stop_dbg_cnt HA_SECTION_S msg = "\n" pfx "condition \"" #cond "\" matched at " file ":" #line "" sfx "\n"; \ if (_HA_ATOMIC_FETCH_ADD(&__match_count_##line, 1)) \ break; \ - complain(NULL, msg, details); \ + complain(details, msg); \ if (details & DBG_DET_FAT_FATL) \ ABORT_NOW(); \ else if (details & DBG_DET_FAT_WARN) \ diff --git a/src/debug.c b/src/debug.c index 84d48917c..9c029837a 100644 --- a/src/debug.c +++ b/src/debug.c @@ -964,16 +964,12 @@ void ha_stuck_warning(void) DISGUISE(write(2, buf.area, buf.data)); } -/* Complain with message on stderr. If is not NULL, it is - * atomically incremented, and the message is only printed when the counter - * was zero, so that the message is only printed once.
is only +/* Complain with message on stderr.
is only * checked on DBG_DET_TYP_BUG, and will taint the process either for a * bug or warn. */ -void complain(int *counter, const char *msg, uint details) +void complain(uint details, const char *msg) { - if (counter && _HA_ATOMIC_FETCH_ADD(counter, 1)) - return; DISGUISE(write(2, msg, strlen(msg))); if (details & (DBG_DET_TYP_BUG|DBG_DET_TYP_ABT)) mark_tainted(TAINTED_BUG);