From 537b7695c26b9ad83ccc13b68c78a2fb27545d7e Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Tue, 24 Jun 2014 16:21:58 -0400 Subject: Fix some warnings found by clang. --- libdimension/error.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'libdimension/error.c') diff --git a/libdimension/error.c b/libdimension/error.c index 1366c4c..e9e7cf1 100644 --- a/libdimension/error.c +++ b/libdimension/error.c @@ -49,10 +49,8 @@ static atomic(dmnsn_fatal_error_fn *) dmnsn_fatal = ATOMIC_VAR_INIT(dmnsn_defaul /// The current resilience. static atomic_bool dmnsn_always_die = ATOMIC_VAR_INIT(false); -// Called by dmnsn_error macro (don't call directly) void -dmnsn_report_error(bool die, const char *func, const char *file, - unsigned int line, const char *str) +dmnsn_report_impl(bool die, const char *func, const char *file, unsigned int line, const char *str) { // Save the value of errno int err = errno; @@ -89,7 +87,7 @@ dmnsn_report_error(bool die, const char *func, const char *file, if (thread_exiting) { if (die) { // Prevent infinite recursion if the fatal error function itself calls - // dmnsn_error() (not dmnsn_warning()) */ + // dmnsn_error() (not dmnsn_warning()) DMNSN_LOCAL_ERROR("Error raised while in error handler, aborting."); } } else { @@ -102,6 +100,19 @@ dmnsn_report_error(bool die, const char *func, const char *file, } } +void +dmnsn_report_warning(const char *func, const char *file, unsigned int line, const char *str) +{ + dmnsn_report_impl(false, func, file, line, str); +} + +DMNSN_NORETURN +dmnsn_report_error(const char *func, const char *file, unsigned int line, const char *str) +{ + dmnsn_report_impl(true, func, file, line, str); + DMNSN_UNREACHABLE(); +} + void dmnsn_die_on_warnings(bool always_die) { -- cgit v1.2.3