diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2018-09-25 11:37:39 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2018-09-25 11:37:39 +0100 |
commit | 2f831d04985f064e9306fa58db516e0a3e1df918 (patch) | |
tree | 428980441c2b8a0acccf8dd7a6909cc255c761e8 /include | |
parent | 8ca19bd882997b69cd9c37adabbfe8360a0a83ee (diff) | |
parent | c468e368e102e8bb93cbbf1c3daa0c04d361d3c4 (diff) |
Merge remote-tracking branch 'remotes/armbru/tags/pull-error-2018-09-24' into staging
Error reporting & miscellaneous patches for 2018-09-24
# gpg: Signature made Mon 24 Sep 2018 16:16:50 BST
# gpg: using RSA key 3870B400EB918653
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>"
# gpg: aka "Markus Armbruster <armbru@pond.sub.org>"
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653
* remotes/armbru/tags/pull-error-2018-09-24:
MAINTAINERS: Fix F: patterns that don't match anything
Drop "qemu:" prefix from error_report() arguments
qemu-error: make use of {error, warn}_report_once_cond
qemu-error: add {error, warn}_report_once_cond
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/qemu/error-report.h | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/include/qemu/error-report.h b/include/qemu/error-report.h index 72fab2b031..0a8d9cc9ea 100644 --- a/include/qemu/error-report.h +++ b/include/qemu/error-report.h @@ -44,36 +44,31 @@ void error_report(const char *fmt, ...) GCC_FMT_ATTR(1, 2); void warn_report(const char *fmt, ...) GCC_FMT_ATTR(1, 2); void info_report(const char *fmt, ...) GCC_FMT_ATTR(1, 2); +bool error_report_once_cond(bool *printed, const char *fmt, ...) + GCC_FMT_ATTR(2, 3); +bool warn_report_once_cond(bool *printed, const char *fmt, ...) + GCC_FMT_ATTR(2, 3); + /* * Similar to error_report(), except it prints the message just once. * Return true when it prints, false otherwise. */ -#define error_report_once(fmt, ...) \ - ({ \ - static bool print_once_; \ - bool ret_print_once_ = !print_once_; \ - \ - if (!print_once_) { \ - print_once_ = true; \ - error_report(fmt, ##__VA_ARGS__); \ - } \ - unlikely(ret_print_once_); \ +#define error_report_once(fmt, ...) \ + ({ \ + static bool print_once_; \ + error_report_once_cond(&print_once_, \ + fmt, ##__VA_ARGS__); \ }) /* * Similar to warn_report(), except it prints the message just once. * Return true when it prints, false otherwise. */ -#define warn_report_once(fmt, ...) \ - ({ \ - static bool print_once_; \ - bool ret_print_once_ = !print_once_; \ - \ - if (!print_once_) { \ - print_once_ = true; \ - warn_report(fmt, ##__VA_ARGS__); \ - } \ - unlikely(ret_print_once_); \ +#define warn_report_once(fmt, ...) \ + ({ \ + static bool print_once_; \ + warn_report_once_cond(&print_once_, \ + fmt, ##__VA_ARGS__); \ }) const char *error_get_progname(void); |