From c0c175fd2688c46595d5aadf029026e147ec80c2 Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Thu, 4 Apr 2013 01:25:34 -0700 Subject: [PATCH] model: add variable arguments for bug messages --- model.cc | 12 ++++++++++-- model.h | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/model.cc b/model.cc index feda4162..cbd5617d 100644 --- a/model.cc +++ b/model.cc @@ -2,6 +2,7 @@ #include #include #include +#include #include "model.h" #include "action.h" @@ -419,9 +420,16 @@ bool ModelChecker::is_complete_execution() const * @param msg Descriptive message for the bug (do not include newline char) * @return True if bug is immediately-feasible */ -bool ModelChecker::assert_bug(const char *msg) +bool ModelChecker::assert_bug(const char *msg, ...) { - priv->bugs.push_back(new bug_message(msg)); + char str[800]; + + va_list ap; + va_start(ap, msg); + vsnprintf(str, sizeof(str), msg, ap); + va_end(ap); + + priv->bugs.push_back(new bug_message(str)); if (isfeasibleprefix()) { set_assert(); diff --git a/model.h b/model.h index 73272809..8fdfc47a 100644 --- a/model.h +++ b/model.h @@ -132,7 +132,7 @@ public: void check_promises(thread_id_t tid, ClockVector *old_cv, ClockVector *merge_cv); bool isfeasibleprefix() const; - bool assert_bug(const char *msg); + bool assert_bug(const char *msg, ...); void assert_user_bug(const char *msg); const model_params params; -- 2.34.1