summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/sexpr-wasm.c10
-rw-r--r--src/wasm-gen.c6
-rw-r--r--src/wasm-internal.h10
-rw-r--r--src/wasm-parse.c14
4 files changed, 17 insertions, 23 deletions
diff --git a/src/sexpr-wasm.c b/src/sexpr-wasm.c
index 95178725..ef4be32d 100644
--- a/src/sexpr-wasm.c
+++ b/src/sexpr-wasm.c
@@ -5,18 +5,10 @@
#include <stdlib.h>
#include "wasm.h"
+#include "wasm-internal.h"
#include "wasm-parse.h"
#include "wasm-gen.h"
-#define FATAL(...) fprintf(stderr, __VA_ARGS__), exit(1)
-#define FATAL_AT(loc, ...) \
- fprintf(stderr, "%d:%d: ", (loc).line, (loc).col), \
- fprintf(stderr, __VA_ARGS__), exit(1)
-#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
-#define STATIC_ASSERT__(x, c) typedef char static_assert_##c[x ? 1 : -1]
-#define STATIC_ASSERT_(x, c) STATIC_ASSERT__(x, c)
-#define STATIC_ASSERT(x) STATIC_ASSERT_(x, __COUNTER__)
-
enum { FLAG_VERBOSE, FLAG_HELP, FLAG_DUMP_MODULE, FLAG_OUTPUT, NUM_FLAGS };
static const char* g_infile;
diff --git a/src/wasm-gen.c b/src/wasm-gen.c
index 1bdfc5aa..43d87941 100644
--- a/src/wasm-gen.c
+++ b/src/wasm-gen.c
@@ -6,14 +6,10 @@
#include <string.h>
#include "wasm.h"
+#include "wasm-internal.h"
#include "wasm-parse.h"
#include "wasm-gen.h"
-#define FATAL(...) fprintf(stderr, __VA_ARGS__), exit(1)
-#define FATAL_AT(loc, ...) \
- fprintf(stderr, "%d:%d: ", (loc).line, (loc).col), \
- fprintf(stderr, __VA_ARGS__), exit(1)
-
#define INITIAL_OUTPUT_BUFFER_CAPACITY (64 * 1024)
#define DEFAULT_MEMORY_EXPORT 1
#define DUMP_OCTETS_PER_LINE 16
diff --git a/src/wasm-internal.h b/src/wasm-internal.h
new file mode 100644
index 00000000..9108fe5e
--- /dev/null
+++ b/src/wasm-internal.h
@@ -0,0 +1,10 @@
+#ifndef WASM_INTERNAL_H
+#define WASM_INTERNAL_H
+
+#define FATAL(...) fprintf(stderr, __VA_ARGS__), exit(1)
+#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
+#define STATIC_ASSERT__(x, c) typedef char static_assert_##c[x ? 1 : -1]
+#define STATIC_ASSERT_(x, c) STATIC_ASSERT__(x, c)
+#define STATIC_ASSERT(x) STATIC_ASSERT_(x, __COUNTER__)
+
+#endif /* WASM_INTERNAL_H */
diff --git a/src/wasm-parse.c b/src/wasm-parse.c
index 7e60c14d..df3d194e 100644
--- a/src/wasm-parse.c
+++ b/src/wasm-parse.c
@@ -7,21 +7,17 @@
#include <string.h>
#include "wasm.h"
+#include "wasm-internal.h"
#include "wasm-parse.h"
+#include "hash.h"
+
#define TABS_TO_SPACES 8
-#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
-#define FATAL(...) fprintf(stderr, __VA_ARGS__), exit(1)
+#define INITIAL_VECTOR_CAPACITY 8
+
#define FATAL_AT(loc, ...) \
fprintf(stderr, "%d:%d: ", (loc).line, (loc).col), \
fprintf(stderr, __VA_ARGS__), exit(1)
-#define STATIC_ASSERT__(x, c) typedef char static_assert_##c[x ? 1 : -1]
-#define STATIC_ASSERT_(x, c) STATIC_ASSERT__(x, c)
-#define STATIC_ASSERT(x) STATIC_ASSERT_(x, __COUNTER__)
-
-#define INITIAL_VECTOR_CAPACITY 8
-
-#include "hash.h"
typedef struct OpInfo OpInfo;
typedef uint8_t MemAccess;