aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/check.c15
-rw-r--r--src/parse.c15
-rw-r--r--src/util.c15
3 files changed, 15 insertions, 30 deletions
diff --git a/src/check.c b/src/check.c
index e1a7187..421d292 100644
--- a/src/check.c
+++ b/src/check.c
@@ -1,6 +1,5 @@
#define _POSIX_C_SOURCE 200809L
-#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdnoreturn.h>
@@ -9,20 +8,6 @@
#include "parse.h"
#include "util.h"
-static noreturn void
-error(struct location loc, const char *fmt, ...)
-{
- fprintf(stderr, "%s:%d:%d ", loc.file, loc.line, loc.column);
-
- va_list ap;
- va_start(ap, fmt);
- vfprintf(stderr, fmt, ap);
- va_end(ap);
-
- fprintf(stderr, "\n");
- exit(EXIT_CHECK);
-}
-
static void
check_toplevels(struct ast_toplevel *tops, int n)
{
diff --git a/src/parse.c b/src/parse.c
index a9d99b0..4bbda03 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -1,25 +1,10 @@
-#define _POSIX_C_SOURCE 200809L
-
-#include <stdarg.h>
#include <stdlib.h>
#include <stdnoreturn.h>
#include <string.h>
#include "parse.h"
#include "util.h"
-static noreturn void
-error(struct location loc, const char *fmt, ...)
-{
- fprintf(stderr, "%s:%d:%d: ", loc.file, loc.line, loc.column);
-
- va_list ap;
- va_start(ap, fmt);
- vfprintf(stderr, fmt, ap);
- va_end(ap);
- fprintf(stderr, "\n");
- exit(EXIT_PARSE);
-}
static int
parse_include(struct lexer *lexer, struct ast_include *inc)
diff --git a/src/util.c b/src/util.c
index 6cc9425..e4d827b 100644
--- a/src/util.c
+++ b/src/util.c
@@ -1,3 +1,4 @@
+#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include "util.h"
@@ -33,3 +34,17 @@ must_realloc(void *ptr, size_t size)
}
return ret;
}
+
+void
+error(struct location loc, const char *fmt, ...)
+{
+ fprintf(stderr, "%s:%d:%d: ", loc.file, loc.line, loc.column);
+
+ va_list ap;
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+
+ fprintf(stderr, "\n");
+ exit(EXIT_PARSE);
+}