summaryrefslogtreecommitdiff
path: root/src/common.h
diff options
context:
space:
mode:
authorBen Smith <binjimin@gmail.com>2018-05-16 19:21:19 -0700
committerGitHub <noreply@github.com>2018-05-16 19:21:19 -0700
commit1fec702978b82945f5e6097f765d505f25f30097 (patch)
treec1df59bd7fdfc8609c1eac150e3dd5a85854c1c7 /src/common.h
parentdd7663d78bf483308cd8d70d114748321f2cd61f (diff)
downloadwabt-1fec702978b82945f5e6097f765d505f25f30097.tar.gz
wabt-1fec702978b82945f5e6097f765d505f25f30097.tar.bz2
wabt-1fec702978b82945f5e6097f765d505f25f30097.zip
Print "warning" for ignored custom section errors (#843)
The previous message said "error", which makes it look like the output is not created, so change the message to "warning" instead. The error handling code is pretty ugly and can use a refactor, but that would be a much larger change.
Diffstat (limited to 'src/common.h')
-rw-r--r--src/common.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/common.h b/src/common.h
index 0d7fa7b5..67cc7320 100644
--- a/src/common.h
+++ b/src/common.h
@@ -102,6 +102,11 @@ struct v128 {
namespace wabt {
+enum class ErrorLevel {
+ Warning,
+ Error,
+};
+
typedef uint32_t Index; // An index into one of the many index spaces.
typedef uint32_t Address; // An address or size in linear memory.
typedef size_t Offset; // An offset into a host's file or memory buffer.
@@ -351,6 +356,18 @@ static WABT_INLINE const char* GetTypeName(Type type) {
WABT_UNREACHABLE;
}
+/* error level */
+
+static WABT_INLINE const char* GetErrorLevelName(ErrorLevel error_level) {
+ switch (error_level) {
+ case ErrorLevel::Warning:
+ return "warning";
+ case ErrorLevel::Error:
+ return "error";
+ }
+ WABT_UNREACHABLE;
+}
+
template <typename T>
void ConvertBackslashToSlash(T begin, T end) {
std::replace(begin, end, '\\', '/');