aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-09-14 00:14:25 +0900
committernsfisis <nsfisis@gmail.com>2025-09-14 01:18:50 +0900
commit90246b99595e86e5e6fe41973db1a00171cf0462 (patch)
treefbf0be4652f5e245d623c85d944dcc5772912663
parentec63d7d6d2f123239ba436ffcb2638f27f3b7d59 (diff)
downloadducc-90246b99595e86e5e6fe41973db1a00171cf0462.tar.gz
ducc-90246b99595e86e5e6fe41973db1a00171cf0462.tar.zst
ducc-90246b99595e86e5e6fe41973db1a00171cf0462.zip
feat: include <stdlib.h>
-rw-r--r--src/ast.c1
-rw-r--r--src/cli.c1
-rw-r--r--src/codegen.c1
-rw-r--r--src/common.c1
-rw-r--r--src/fs.c1
-rw-r--r--src/io.c1
-rw-r--r--src/json.c1
-rw-r--r--src/main.c1
-rw-r--r--src/parse.c1
-rw-r--r--src/preprocess.c1
-rw-r--r--src/std.h7
-rw-r--r--src/sys.c3
-rw-r--r--src/token.c1
-rw-r--r--src/tokenize.c1
-rw-r--r--tests/include_stdc.sh2
15 files changed, 17 insertions, 7 deletions
diff --git a/src/ast.c b/src/ast.c
index cdfd9a0..b329d12 100644
--- a/src/ast.c
+++ b/src/ast.c
@@ -1,4 +1,5 @@
#include "ast.h"
+#include <stdlib.h>
#include <string.h>
#include "common.h"
#include "preprocess.h"
diff --git a/src/cli.c b/src/cli.c
index 9b62614..de30033 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -1,5 +1,6 @@
#include "cli.h"
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include "common.h"
#include "version.h"
diff --git a/src/codegen.c b/src/codegen.c
index 6b3c858..db6514d 100644
--- a/src/codegen.c
+++ b/src/codegen.c
@@ -1,4 +1,5 @@
#include "codegen.h"
+#include <stdlib.h>
#include <string.h>
#include "common.h"
#include "preprocess.h"
diff --git a/src/common.c b/src/common.c
index 75ca0ca..61b2805 100644
--- a/src/common.c
+++ b/src/common.c
@@ -1,6 +1,7 @@
#include "common.h"
#include <stdarg.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
void fatal_error(const char* msg, ...) {
diff --git a/src/fs.c b/src/fs.c
index b5e31dd..67d808e 100644
--- a/src/fs.c
+++ b/src/fs.c
@@ -1,4 +1,5 @@
#include "fs.h"
+#include <stdlib.h>
#include <string.h>
#include "std.h"
diff --git a/src/io.c b/src/io.c
index 7d0b875..897f1a3 100644
--- a/src/io.c
+++ b/src/io.c
@@ -1,5 +1,6 @@
#include "io.h"
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include "common.h"
#include "json.h"
diff --git a/src/json.c b/src/json.c
index a1524aa..0384516 100644
--- a/src/json.c
+++ b/src/json.c
@@ -1,5 +1,6 @@
#include "json.h"
#include <stdio.h>
+#include <stdlib.h>
#include "common.h"
struct JsonBuilder {
diff --git a/src/main.c b/src/main.c
index bd1391c..bcb3697 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,3 +1,4 @@
+#include <stdlib.h>
#include <string.h>
#include "ast.h"
#include "cli.h"
diff --git a/src/parse.c b/src/parse.c
index afbb282..911a59e 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -1,5 +1,6 @@
#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 00b01dd..a32e0e5 100644
--- a/src/preprocess.c
+++ b/src/preprocess.c
@@ -1,6 +1,7 @@
#include "preprocess.h"
#include <ctype.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include "common.h"
#include "parse.h"
diff --git a/src/std.h b/src/std.h
index 2d7d8c8..140eea8 100644
--- a/src/std.h
+++ b/src/std.h
@@ -3,13 +3,8 @@
#include <stddef.h>
-int atoi(const char*);
-void* calloc(size_t, size_t);
-void exit(int);
+// TODO: <stdlib.h>
int mkstemps(char*, int);
-void* realloc(void*, size_t);
-long strtol(const char*, char**, int);
-int system(const char*);
#define assert(x) \
do { \
diff --git a/src/sys.c b/src/sys.c
index a4a531c..67a3c41 100644
--- a/src/sys.c
+++ b/src/sys.c
@@ -1,8 +1,11 @@
#include "sys.h"
+#include <stdlib.h>
#include "std.h"
// TODO: #inclue some header.
+#ifndef __ducc__
typedef long ssize_t;
+#endif
ssize_t readlink(const char*, char*, size_t);
static char* get_self_path() {
diff --git a/src/token.c b/src/token.c
index 1942ffb..554d783 100644
--- a/src/token.c
+++ b/src/token.c
@@ -1,5 +1,6 @@
#include "token.h"
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include "common.h"
#include "json.h"
diff --git a/src/tokenize.c b/src/tokenize.c
index c6f46a5..cb945e1 100644
--- a/src/tokenize.c
+++ b/src/tokenize.c
@@ -1,4 +1,5 @@
#include "tokenize.h"
+#include <stdlib.h>
#include <string.h>
#include "common.h"
diff --git a/tests/include_stdc.sh b/tests/include_stdc.sh
index 9cb13fd..54d8b1d 100644
--- a/tests/include_stdc.sh
+++ b/tests/include_stdc.sh
@@ -12,7 +12,7 @@ test_diff <<'EOF'
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
-// #include <stdlib.h>
+#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <uchar.h>