aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-09-27 20:29:43 +0900
committernsfisis <nsfisis@gmail.com>2025-09-27 20:29:43 +0900
commit86ae353d6267387bf216d5fd760a7ced7bced402 (patch)
tree7a2bfa1d40a6b5fd2aa366ca5a8f32837a8477ab /src
parent1c270ba5e27f126a251b5591cfac4243ba3c75f7 (diff)
downloadducc-86ae353d6267387bf216d5fd760a7ced7bced402.tar.gz
ducc-86ae353d6267387bf216d5fd760a7ced7bced402.tar.zst
ducc-86ae353d6267387bf216d5fd760a7ced7bced402.zip
refactor: add src/ducc.h
Diffstat (limited to 'src')
-rw-r--r--src/ast.c2
-rw-r--r--src/ast.h2
-rw-r--r--src/codegen.h1
-rw-r--r--src/common.h2
-rw-r--r--src/ducc.h11
-rw-r--r--src/main.c2
-rw-r--r--src/parse.c3
-rw-r--r--src/preprocess.c4
-rw-r--r--src/preprocess.h1
-rw-r--r--src/sys.c2
-rw-r--r--src/token.c3
-rw-r--r--src/token.h3
-rw-r--r--src/tokenize.c2
13 files changed, 15 insertions, 23 deletions
diff --git a/src/ast.c b/src/ast.c
index 948ded2..388e211 100644
--- a/src/ast.c
+++ b/src/ast.c
@@ -1,6 +1,4 @@
#include "ast.h"
-#include <stdlib.h>
-#include <string.h>
#include "common.h"
#include "preprocess.h"
diff --git a/src/ast.h b/src/ast.h
index 04cc1ec..3c92eed 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -1,7 +1,7 @@
#ifndef DUCC_AST_H
#define DUCC_AST_H
-#include <stddef.h>
+#include "ducc.h"
typedef enum {
StorageClass_unspecified,
diff --git a/src/codegen.h b/src/codegen.h
index 6a75179..95ec069 100644
--- a/src/codegen.h
+++ b/src/codegen.h
@@ -1,7 +1,6 @@
#ifndef DUCC_CODEGEN_H
#define DUCC_CODEGEN_H
-#include <stdio.h>
#include "ast.h"
void codegen(Program* prog, FILE* out);
diff --git a/src/common.h b/src/common.h
index 94f75b1..b6fc238 100644
--- a/src/common.h
+++ b/src/common.h
@@ -1,7 +1,7 @@
#ifndef DUCC_COMMON_H
#define DUCC_COMMON_H
-#include <stddef.h>
+#include "ducc.h"
_Noreturn void fatal_error(const char* msg, ...);
diff --git a/src/ducc.h b/src/ducc.h
new file mode 100644
index 0000000..31ee977
--- /dev/null
+++ b/src/ducc.h
@@ -0,0 +1,11 @@
+#ifndef DUCC_DUCC_H
+#define DUCC_DUCC_H
+
+#include <assert.h>
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#endif
diff --git a/src/main.c b/src/main.c
index 57b542c..92066cf 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,5 +1,3 @@
-#include <stdlib.h>
-#include <string.h>
#include "ast.h"
#include "cli.h"
#include "codegen.h"
diff --git a/src/parse.c b/src/parse.c
index 21d399b..da1345d 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -1,7 +1,4 @@
#include "parse.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#include "common.h"
#include "tokenize.h"
diff --git a/src/preprocess.c b/src/preprocess.c
index f9fbcb4..d3c662b 100644
--- a/src/preprocess.c
+++ b/src/preprocess.c
@@ -1,9 +1,5 @@
#include "preprocess.h"
-#include <assert.h>
#include <libgen.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#include <unistd.h>
#include "common.h"
#include "parse.h"
diff --git a/src/preprocess.h b/src/preprocess.h
index e78776f..a39f01c 100644
--- a/src/preprocess.h
+++ b/src/preprocess.h
@@ -1,7 +1,6 @@
#ifndef DUCC_PREPROCESS_H
#define DUCC_PREPROCESS_H
-#include <stdio.h>
#include "common.h"
#include "io.h"
#include "token.h"
diff --git a/src/sys.c b/src/sys.c
index ba946a1..7e0025a 100644
--- a/src/sys.c
+++ b/src/sys.c
@@ -1,8 +1,8 @@
#include "sys.h"
#include <libgen.h>
#include <linux/limits.h>
-#include <stdlib.h>
#include <unistd.h>
+#include "ducc.h"
static char* get_self_path() {
char* buf = calloc(PATH_MAX, sizeof(char));
diff --git a/src/token.c b/src/token.c
index 554d783..0790e95 100644
--- a/src/token.c
+++ b/src/token.c
@@ -1,7 +1,4 @@
#include "token.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#include "common.h"
#include "json.h"
diff --git a/src/token.h b/src/token.h
index ced3de3..9dc89e8 100644
--- a/src/token.h
+++ b/src/token.h
@@ -1,9 +1,8 @@
#ifndef DUCC_TOKEN_H
#define DUCC_TOKEN_H
-#include <stddef.h>
+#include "ducc.h"
#include "io.h"
-#include "json.h"
typedef enum {
TokenKind_eof,
diff --git a/src/tokenize.c b/src/tokenize.c
index fbbc92a..57a5c61 100644
--- a/src/tokenize.c
+++ b/src/tokenize.c
@@ -1,7 +1,5 @@
#include "tokenize.h"
#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
#include "common.h"
typedef struct {