From: Alain Spineux Date: Fri, 28 Feb 2020 12:31:29 +0000 (+0100) Subject: unittest fix gdb_print_local() used by _ok() to avoid "tail call" X-Git-Tag: Release-11.3.2~984 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=20f3bd2064e69b58f9d4e5bc11da5dc5e9e63900;p=thirdparty%2Fbacula.git unittest fix gdb_print_local() used by _ok() to avoid "tail call" - compiler can do "tail call" optimization and "hide" functions in the "call stack" and disturb gdb_print_local() usage --- diff --git a/bacula/src/lib/unittests.c b/bacula/src/lib/unittests.c index 6530c5960..2e6dc6cc7 100644 --- a/bacula/src/lib/unittests.c +++ b/bacula/src/lib/unittests.c @@ -84,15 +84,15 @@ bool _ok(const char *file, int l, const char *op, int value, const char *label) { nb++; if (!value) { - err++; if (err < 1000) { Pmsg4(-1, "ERR %.80s %s:%i on %s\n", label, file, l, op); } else if (err == 1000) { Pmsg0(-1, "ERR Too much errors\n"); } if (print_var) { - gdb_print_local(1); + gdb_print_local(1); // make sure this line is not the last operation before the return } + err++; // keep this line AFTER the gdb_print_local() to avoid "tail call" optimization } else if (!quiet) { Pmsg1(-1, "OK %.80s\n", label); }