aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2026-01-10 11:50:55 +0100
committerlemon <lsof@mailbox.org>2026-01-10 11:50:55 +0100
commit828c85c8d3c565f03dd794296305caecc428f467 (patch)
tree7c54bf88bdd455b6e0799ce4756e6b017a50a006
parent40bd2090ddc53cecadd2b4ec1be6895059c05941 (diff)
cpp: prioritize internal headers over system headers
-rw-r--r--c/lex.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/c/lex.c b/c/lex.c
index 7eb1a2c..f1dab08 100644
--- a/c/lex.c
+++ b/c/lex.c
@@ -1605,6 +1605,12 @@ ppinclude(struct lexer *lx, const struct span *span0)
path[end - base + tk.len] = 0;
if (tryinclude(lx, &span, path)) return;
}
+ /* try embedded files pseudo-path */
+ xbgrow(&path, tk.len + 3);
+ path[0] = '@', path[1] = ':';
+ memcpy(path+2, tk.s, tk.len);
+ path[tk.len+2] = 0;
+ if (tryinclude(lx, &span, path)) return;
/* try system paths */
for (struct inclpaths *p = cinclpaths; p; p = p->next) {
int ndir = strlen(p->path);
@@ -1615,12 +1621,6 @@ ppinclude(struct lexer *lx, const struct span *span0)
path[ndir + tk.len] = 0;
if (tryinclude(lx, &span, path)) return;
}
- /* try embedded files pseudo-path */
- xbgrow(&path, tk.len + 3);
- path[0] = '@', path[1] = ':';
- memcpy(path+2, tk.s, tk.len);
- path[tk.len+2] = 0;
- if (tryinclude(lx, &span, path)) return;
NotFound:
error(&tk.span, "file not found: %'S", tk.s, tk.len);
} else {