[waffle] [PATCH 05/11] core: Add func wcore_error_bad_attribute

Chad Versace chad.versace at linux.intel.com
Tue Dec 16 00:18:29 PST 2014


This little helper function emits WAFFLE_ERROR_BAD_ATTRIBUTE with
a default error message.

Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
---
 src/waffle/core/wcore_error.c | 8 ++++++++
 src/waffle/core/wcore_error.h | 4 ++++
 2 files changed, 12 insertions(+)

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__)
-- 
2.2.0



More information about the waffle mailing list