aboutsummaryrefslogtreecommitdiff
path: root/libtcc.c
diff options
context:
space:
mode:
authorSteffen Nurpmeso <steffen@sdaoden.eu>2017-09-30 00:13:05 +0200
committerSteffen Nurpmeso <steffen@sdaoden.eu>2017-10-03 17:58:45 +0200
commit1d5e386b0a78393ac6b670c209a185849ec798a1 (patch)
tree6f01f1f94079d73ee45caefe3ea3fa4ae5ecac61 /libtcc.c
parenta1c90513131164500f503108a845fee1e8632cc6 (diff)
downloadtinycc-1d5e386b0a78393ac6b670c209a185849ec798a1.tar.gz
tinycc-1d5e386b0a78393ac6b670c209a185849ec798a1.tar.bz2
Introduce VIP sysinclude paths which are always searched first
Diffstat (limited to 'libtcc.c')
-rw-r--r--libtcc.c10
1 files changed, 9 insertions, 1 deletions
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,