aboutsummaryrefslogtreecommitdiffhomepage
path: root/main.c
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2025-10-13 19:06:52 +0200
committerlemon <lsof@mailbox.org>2025-10-13 19:09:48 +0200
commit9812f88a9a612144bea02c7acf499867eb0cbeb9 (patch)
tree0575b7c6b6b72b0683c4ffae108292b3d44998be /main.c
parent3048a0b59baae16727d0c259353ff4be1ae559b4 (diff)
implement most of preprocessor
- concatenation (##) - builtin macros (__FILE__ etc) - fails in some edge cases, and code needs cleanup - add embedded system include files (stddef.h, stdarg.h for now) - can handle stdio.h now
Diffstat (limited to 'main.c')
-rw-r--r--main.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/main.c b/main.c
index 2b98cab..1f75a50 100644
--- a/main.c
+++ b/main.c
@@ -7,6 +7,7 @@
#include <unistd.h>
struct option ccopt;
+struct inclpaths *cinclpaths;
static void
flushstd(void)
@@ -348,6 +349,21 @@ detectcolor(void)
ccopt.nocolor = 1;
}
+static void
+sysinclpaths(void)
+{
+ static const char *paths[] = {
+ "/usr/local/include",
+ "/usr/include"
+ };
+ for (int i = 0; i < arraylength(paths); ++i) {
+ struct inclpaths *p = alloc(&globarena, sizeof *cinclpaths, 0);
+ p->next = cinclpaths;
+ p->path = paths[i];
+ cinclpaths = p;
+ }
+}
+
int
main(int argc, char **argv)
{
@@ -356,6 +372,7 @@ main(int argc, char **argv)
/* setup defaults */
detectcolor();
+ sysinclpaths();
ccopt.cstd = STDC99;
ccopt.pie = 1;