From 1d5e386b0a78393ac6b670c209a185849ec798a1 Mon Sep 17 00:00:00 2001 From: Steffen Nurpmeso Date: Sat, 30 Sep 2017 00:13:05 +0200 Subject: Introduce VIP sysinclude paths which are always searched first --- libtcc.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'libtcc.c') diff --git a/libtcc.c b/libtcc.c index dcc398f..9ef538e 100644 --- a/libtcc.c +++ b/libtcc.c @@ -906,6 +906,7 @@ LIBTCCAPI void tcc_delete(TCCState *s1) /* free include paths */ dynarray_reset(&s1->cached_includes, &s1->nb_cached_includes); + dynarray_reset(&s1->tccinclude_paths, &s1->nb_tccinclude_paths); dynarray_reset(&s1->include_paths, &s1->nb_include_paths); dynarray_reset(&s1->sysinclude_paths, &s1->nb_sysinclude_paths); dynarray_reset(&s1->cmd_include_files, &s1->nb_cmd_include_files); @@ -946,6 +947,7 @@ LIBTCCAPI int tcc_set_output_type(TCCState *s, int output_type) if (!s->nostdinc) { /* default include paths */ /* -isystem paths have already been handled */ + tcc_add_tccinclude_path(s, CONFIG_TCC_TCCINCLUDEPATHS); tcc_add_sysinclude_path(s, CONFIG_TCC_SYSINCLUDEPATHS); } @@ -983,6 +985,12 @@ LIBTCCAPI int tcc_set_output_type(TCCState *s, int output_type) return 0; } +LIBTCCAPI int tcc_add_tccinclude_path(TCCState *s, const char *pathname) +{ + tcc_split_path(s, &s->tccinclude_paths, &s->nb_tccinclude_paths, pathname); + return 0; +} + LIBTCCAPI int tcc_add_include_path(TCCState *s, const char *pathname) { tcc_split_path(s, &s->include_paths, &s->nb_include_paths, pathname); @@ -1821,7 +1829,7 @@ reparse: break; case TCC_OPTION_iwithprefix: snprintf(buf, sizeof buf, "{B}/%s", optarg); - tcc_add_sysinclude_path(s, buf); + tcc_add_tccinclude_path(s, buf); break; case TCC_OPTION_include: dynarray_add(&s->cmd_include_files, -- cgit v1.3.1