summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChad Versace <chad.versace@intel.com>2015-01-04 13:36:21 -0800
committerChad Versace <chad.versace@intel.com>2015-01-27 09:36:06 -0800
commitd2594d1e8b8ba8e0377a9afe007e1cf49a0a93d0 (patch)
tree11d1bc97c51a49af95fa71042f140fe3fbebef10
parentcc177e965aed3fe4c35d1164ff4b7aea079d7257 (diff)
core: Add func wcore_error_bad_attribute
This little helper function emits WAFFLE_ERROR_BAD_ATTRIBUTE with a default error message. Signed-off-by: Chad Versace <chad.versace@intel.com> Tested-by: Emil Velikov <emil.l.velikov@gmail.com> (msvc/wgl) Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
-rw-r--r--src/waffle/core/wcore_error.c8
-rw-r--r--src/waffle/core/wcore_error.h4
2 files changed, 12 insertions, 0 deletions
diff --git a/src/waffle/core/wcore_error.c b/src/waffle/core/wcore_error.c
index fdf70f8..e755ac5 100644
--- a/src/waffle/core/wcore_error.c
+++ b/src/waffle/core/wcore_error.c
@@ -24,6 +24,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <errno.h>
+#include <inttypes.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
@@ -170,6 +171,13 @@ wcore_error_errno(const char *format, ...)
}
void
+wcore_error_bad_attribute(intptr_t attr)
+{
+ wcore_errorf(WAFFLE_ERROR_BAD_ATTRIBUTE,
+ "bad attribute 0x%"PRIxPTR, attr);
+}
+
+void
_wcore_error_internal(const char *file, int line, const char *format, ...)
{
struct wcore_error_tinfo *t = wcore_tinfo_get()->error;
diff --git a/src/waffle/core/wcore_error.h b/src/waffle/core/wcore_error.h
index e2d3189..0a9767c 100644
--- a/src/waffle/core/wcore_error.h
+++ b/src/waffle/core/wcore_error.h
@@ -63,6 +63,10 @@ wcore_errorf(enum waffle_error error, const char *format, ...);
void
wcore_error_errno(const char *format, ...);
+/// @brief Emit WAFFLE_ERROR_BAD_ATTRIBUTE with a default error message.
+void
+wcore_error_bad_attribute(intptr_t attr);
+
/// @brief Set error to WAFFLE_INTERNAL_ERROR with source location.
#define wcore_error_internal(format, ...) \
_wcore_error_internal(__FILE__, __LINE__, format, __VA_ARGS__)