diff options
| author | Steffen Nurpmeso <steffen@sdaoden.eu> | 2017-09-30 00:13:05 +0200 |
|---|---|---|
| committer | Steffen Nurpmeso <steffen@sdaoden.eu> | 2017-10-03 17:58:45 +0200 |
| commit | 1d5e386b0a78393ac6b670c209a185849ec798a1 (patch) | |
| tree | 6f01f1f94079d73ee45caefe3ea3fa4ae5ecac61 /tccpp.c | |
| parent | a1c90513131164500f503108a845fee1e8632cc6 (diff) | |
| download | tinycc-1d5e386b0a78393ac6b670c209a185849ec798a1.tar.gz tinycc-1d5e386b0a78393ac6b670c209a185849ec798a1.tar.bz2 | |
Introduce VIP sysinclude paths which are always searched first
Diffstat (limited to 'tccpp.c')
| -rw-r--r-- | tccpp.c | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -1803,7 +1803,8 @@ ST_FUNC void preprocess(int is_bof) /* store current file in stack, but increment stack later below */ *s1->include_stack_ptr = file; i = tok == TOK_INCLUDE_NEXT ? file->include_next_index : 0; - n = 2 + s1->nb_include_paths + s1->nb_sysinclude_paths; + n = 2 + s1->nb_tccinclude_paths + s1->nb_include_paths + + s1->nb_sysinclude_paths; for (; i < n; ++i) { char buf1[sizeof file->filename]; CachedInclude *e; @@ -1825,8 +1826,14 @@ ST_FUNC void preprocess(int is_bof) } else { /* search in all the include paths */ - int j = i - 2, k = j - s1->nb_include_paths; - path = k < 0 ? s1->include_paths[j] : s1->sysinclude_paths[k]; + int k, j = i - 2; + + if (j < (k = s1->nb_tccinclude_paths)) + path = s1->tccinclude_paths[j]; + else if ((j -= k) < s1->nb_include_paths) + path = s1->include_paths[j]; + else if ((j -= s1->nb_include_paths) < s1->nb_sysinclude_paths) + path = s1->sysinclude_paths[j]; pstrcpy(buf1, sizeof(buf1), path); pstrcat(buf1, sizeof(buf1), "/"); } |
