From 828c85c8d3c565f03dd794296305caecc428f467 Mon Sep 17 00:00:00 2001 From: lemon Date: Sat, 10 Jan 2026 11:50:55 +0100 Subject: cpp: prioritize internal headers over system headers --- c/lex.c | 12 ++++++------ 1 file 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 { -- cgit v1.2.3