That's certainly a solution... but I wonder whether it might be easier to simply fix the failing tests instead, to make sure that they do not pass a value > sizeof(int) to report() and report_xfail_status() ?
I really don't like that. Like if assert() would suddenly ignore anything above (32bit) - If this is the case then I shall be silent :D
Another idea would be to swap the parameters of report() and report_xfail_status() : diff --git a/lib/libcflat.h b/lib/libcflat.h index b94d0ac..d6d1323 100644 --- a/lib/libcflat.h +++ b/lib/libcflat.h @@ -99,10 +99,10 @@ void report_prefix_pushf(const char *prefix_fmt, ...) __attribute__((format(printf, 1, 2))); extern void report_prefix_push(const char *prefix); extern void report_prefix_pop(void); -extern void report(const char *msg_fmt, bool pass, ...) - __attribute__((format(printf, 1, 3))); -extern void report_xfail(const char *msg_fmt, bool xfail, bool pass, ...) - __attribute__((format(printf, 1, 4))); +extern void report(bool pass, const char *msg_fmt, ...) + __attribute__((format(printf, 2, 3))); +extern void report_xfail(bool xfail, bool pass, const char *msg_fmt, ...) + __attribute__((format(printf, 3, 4))); extern void report_abort(const char *msg_fmt, ...) __attribute__((format(printf, 1, 2))) __attribute__((noreturn)); diff --git a/lib/report.c b/lib/report.c index ca9b4fd..2255dc3 100644 --- a/lib/report.c +++ b/lib/report.c @@ -104,18 +104,18 @@ static void va_report(const char *msg_fmt, spin_unlock(&lock); } -void report(const char *msg_fmt, bool pass, ...) +void report(bool pass, const char *msg_fmt, ...) { va_list va; - va_start(va, pass); + va_start(va, msg_fmt); va_report(msg_fmt, pass, false, false, va); va_end(va); } -void report_xfail(const char *msg_fmt, bool xfail, bool pass, ...) +void report_xfail(bool xfail, bool pass, const char *msg_fmt, ...) { va_list va; - va_start(va, pass); + va_start(va, msg_fmt); va_report(msg_fmt, pass, xfail, false, va); va_end(va); } ... then we can keep the "bool" - but we have to fix all calling sites, too.
At least for my taste, please do keep the bool. This sounds like one way to do it.
Paolo, any preferences? Thomas
-- Thanks, David / dhildenb