Mercurial > hg > CbC > CbC_gcc
comparison gcc/incpath.c @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | f6334be47118 |
children | 84e7813d76e9 |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
1 /* Set up combined include path chain for the preprocessor. | 1 /* Set up combined include path chain for the preprocessor. |
2 Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, | 2 Copyright (C) 1986-2017 Free Software Foundation, Inc. |
3 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010 | |
4 Free Software Foundation, Inc. | |
5 | 3 |
6 Broken out of cppinit.c and cppfiles.c and rewritten Mar 2003. | 4 Broken out of cppinit.c and cppfiles.c and rewritten Mar 2003. |
7 | 5 |
8 This program is free software; you can redistribute it and/or modify it | 6 This program is free software; you can redistribute it and/or modify it |
9 under the terms of the GNU General Public License as published by the | 7 under the terms of the GNU General Public License as published by the |
20 <http://www.gnu.org/licenses/>. */ | 18 <http://www.gnu.org/licenses/>. */ |
21 | 19 |
22 #include "config.h" | 20 #include "config.h" |
23 #include "system.h" | 21 #include "system.h" |
24 #include "coretypes.h" | 22 #include "coretypes.h" |
25 #include "machmode.h" | |
26 #include "target.h" | 23 #include "target.h" |
27 #include "tm.h" | |
28 #include "cpplib.h" | 24 #include "cpplib.h" |
29 #include "prefix.h" | 25 #include "prefix.h" |
30 #include "intl.h" | 26 #include "intl.h" |
31 #include "incpath.h" | 27 #include "incpath.h" |
32 #include "cppdefault.h" | 28 #include "cppdefault.h" |
33 | 29 |
34 /* Microsoft Windows does not natively support inodes. | 30 /* Microsoft Windows does not natively support inodes. |
35 VMS has non-numeric inodes. */ | 31 VMS has non-numeric inodes. */ |
36 #ifdef VMS | 32 #ifdef VMS |
37 # define INO_T_EQ(A, B) (!memcmp (&(A), &(B), sizeof (A))) | 33 # define INO_T_EQ(A, B) (!memcmp (&(A), &(B), sizeof (A))) |
38 # define INO_T_COPY(DEST, SRC) memcpy(&(DEST), &(SRC), sizeof (SRC)) | 34 # define INO_T_COPY(DEST, SRC) memcpy (&(DEST), &(SRC), sizeof (SRC)) |
39 #elif !defined (HOST_LACKS_INODE_NUMBERS) | 35 #elif !defined (HOST_LACKS_INODE_NUMBERS) |
40 # define INO_T_EQ(A, B) ((A) == (B)) | 36 # define INO_T_EQ(A, B) ((A) == (B)) |
41 # define INO_T_COPY(DEST, SRC) (DEST) = (SRC) | 37 # define INO_T_COPY(DEST, SRC) (DEST) = (SRC) |
42 #endif | 38 #endif |
43 | 39 |
44 #if defined INO_T_EQ | 40 #if defined INO_T_EQ |
45 #define DIRS_EQ(A, B) ((A)->dev == (B)->dev \ | 41 #define DIRS_EQ(A, B) ((A)->dev == (B)->dev \ |
46 && INO_T_EQ((A)->ino, (B)->ino)) | 42 && INO_T_EQ ((A)->ino, (B)->ino)) |
47 #else | 43 #else |
48 #define DIRS_EQ(A, B) (!strcmp ((A)->canonical_name, (B)->canonical_name)) | 44 #define DIRS_EQ(A, B) (!filename_cmp ((A)->canonical_name, (B)->canonical_name)) |
49 #endif | 45 #endif |
50 | 46 |
51 static const char dir_separator_str[] = { DIR_SEPARATOR, 0 }; | 47 static const char dir_separator_str[] = { DIR_SEPARATOR, 0 }; |
52 | 48 |
53 static void add_env_var_paths (const char *, int); | 49 static void add_env_var_paths (const char *, incpath_kind); |
54 static void add_standard_paths (const char *, const char *, const char *, int); | 50 static void add_standard_paths (const char *, const char *, const char *, int); |
55 static void free_path (struct cpp_dir *, int); | 51 static void free_path (struct cpp_dir *, int); |
56 static void merge_include_chains (const char *, cpp_reader *, int); | 52 static void merge_include_chains (const char *, cpp_reader *, int); |
57 static void add_sysroot_to_chain (const char *, int); | 53 static void add_sysroot_to_chain (const char *, int); |
58 static struct cpp_dir *remove_duplicates (cpp_reader *, struct cpp_dir *, | 54 static struct cpp_dir *remove_duplicates (cpp_reader *, struct cpp_dir *, |
59 struct cpp_dir *, | 55 struct cpp_dir *, |
60 struct cpp_dir *, int); | 56 struct cpp_dir *, int); |
61 | 57 |
62 /* Include chains heads and tails. */ | 58 /* Include chains heads and tails. */ |
63 static struct cpp_dir *heads[4]; | 59 static struct cpp_dir *heads[INC_MAX]; |
64 static struct cpp_dir *tails[4]; | 60 static struct cpp_dir *tails[INC_MAX]; |
61 | |
65 static bool quote_ignores_source_dir; | 62 static bool quote_ignores_source_dir; |
66 enum { REASON_QUIET = 0, REASON_NOENT, REASON_DUP, REASON_DUP_SYS }; | 63 enum { REASON_QUIET = 0, REASON_NOENT, REASON_DUP, REASON_DUP_SYS }; |
67 | 64 |
68 /* Free an element of the include chain, possibly giving a reason. */ | 65 /* Free an element of the include chain, possibly giving a reason. */ |
69 static void | 66 static void |
94 } | 91 } |
95 | 92 |
96 /* Read ENV_VAR for a PATH_SEPARATOR-separated list of file names; and | 93 /* Read ENV_VAR for a PATH_SEPARATOR-separated list of file names; and |
97 append all the names to the search path CHAIN. */ | 94 append all the names to the search path CHAIN. */ |
98 static void | 95 static void |
99 add_env_var_paths (const char *env_var, int chain) | 96 add_env_var_paths (const char *env_var, incpath_kind chain) |
100 { | 97 { |
101 char *p, *q, *path; | 98 char *p, *q, *path; |
102 | 99 |
103 q = getenv (env_var); | 100 q = getenv (env_var); |
104 | 101 |
118 path = XNEWVEC (char, q - p + 1); | 115 path = XNEWVEC (char, q - p + 1); |
119 memcpy (path, p, q - p); | 116 memcpy (path, p, q - p); |
120 path[q - p] = '\0'; | 117 path[q - p] = '\0'; |
121 } | 118 } |
122 | 119 |
123 add_path (path, chain, chain == SYSTEM, false); | 120 add_path (path, chain, chain == INC_SYSTEM, false); |
124 } | 121 } |
125 } | 122 } |
126 | 123 |
127 /* Append the standard include chain defined in cppdefault.c. */ | 124 /* Append the standard include chain defined in cppdefault.c. */ |
128 static void | 125 static void |
129 add_standard_paths (const char *sysroot, const char *iprefix, | 126 add_standard_paths (const char *sysroot, const char *iprefix, |
130 const char *imultilib, int cxx_stdinc) | 127 const char *imultilib, int cxx_stdinc) |
131 { | 128 { |
132 const struct default_include *p; | 129 const struct default_include *p; |
133 int relocated = cpp_relocated(); | 130 int relocated = cpp_relocated (); |
134 size_t len; | 131 size_t len; |
135 | 132 |
136 if (iprefix && (len = cpp_GCC_INCLUDE_DIR_len) != 0) | 133 if (iprefix && (len = cpp_GCC_INCLUDE_DIR_len) != 0) |
137 { | 134 { |
138 /* Look for directories that start with the standard prefix. | 135 /* Look for directories that start with the standard prefix. |
145 /* Should we be translating sysrooted dirs too? Assume | 142 /* Should we be translating sysrooted dirs too? Assume |
146 that iprefix and sysroot are mutually exclusive, for | 143 that iprefix and sysroot are mutually exclusive, for |
147 now. */ | 144 now. */ |
148 if (sysroot && p->add_sysroot) | 145 if (sysroot && p->add_sysroot) |
149 continue; | 146 continue; |
150 if (!strncmp (p->fname, cpp_GCC_INCLUDE_DIR, len)) | 147 if (!filename_ncmp (p->fname, cpp_GCC_INCLUDE_DIR, len)) |
151 { | 148 { |
152 char *str = concat (iprefix, p->fname + len, NULL); | 149 char *str = concat (iprefix, p->fname + len, NULL); |
153 if (p->multilib && imultilib) | 150 if (p->multilib == 1 && imultilib) |
154 str = concat (str, dir_separator_str, imultilib, NULL); | 151 str = reconcat (str, str, dir_separator_str, |
155 add_path (str, SYSTEM, p->cxx_aware, false); | 152 imultilib, NULL); |
153 else if (p->multilib == 2) | |
154 { | |
155 if (!imultiarch) | |
156 { | |
157 free (str); | |
158 continue; | |
159 } | |
160 str = reconcat (str, str, dir_separator_str, | |
161 imultiarch, NULL); | |
162 } | |
163 add_path (str, INC_SYSTEM, p->cxx_aware, false); | |
156 } | 164 } |
157 } | 165 } |
158 } | 166 } |
159 } | 167 } |
160 | 168 |
164 { | 172 { |
165 char *str; | 173 char *str; |
166 | 174 |
167 /* Should this directory start with the sysroot? */ | 175 /* Should this directory start with the sysroot? */ |
168 if (sysroot && p->add_sysroot) | 176 if (sysroot && p->add_sysroot) |
169 str = concat (sysroot, p->fname, NULL); | 177 { |
178 char *sysroot_no_trailing_dir_separator = xstrdup (sysroot); | |
179 size_t sysroot_len = strlen (sysroot); | |
180 | |
181 if (sysroot_len > 0 && sysroot[sysroot_len - 1] == DIR_SEPARATOR) | |
182 sysroot_no_trailing_dir_separator[sysroot_len - 1] = '\0'; | |
183 str = concat (sysroot_no_trailing_dir_separator, p->fname, NULL); | |
184 free (sysroot_no_trailing_dir_separator); | |
185 } | |
170 else if (!p->add_sysroot && relocated | 186 else if (!p->add_sysroot && relocated |
171 && strncmp (p->fname, cpp_PREFIX, cpp_PREFIX_len) == 0) | 187 && !filename_ncmp (p->fname, cpp_PREFIX, cpp_PREFIX_len)) |
172 { | 188 { |
173 static const char *relocated_prefix; | 189 static const char *relocated_prefix; |
190 char *ostr; | |
174 /* If this path starts with the configure-time prefix, | 191 /* If this path starts with the configure-time prefix, |
175 but the compiler has been relocated, replace it | 192 but the compiler has been relocated, replace it |
176 with the run-time prefix. The run-time exec prefix | 193 with the run-time prefix. The run-time exec prefix |
177 is GCC_EXEC_PREFIX. Compute the path from there back | 194 is GCC_EXEC_PREFIX. Compute the path from there back |
178 to the toplevel prefix. */ | 195 to the toplevel prefix. */ |
184 dummy = concat (gcc_exec_prefix, "dummy", NULL); | 201 dummy = concat (gcc_exec_prefix, "dummy", NULL); |
185 relocated_prefix | 202 relocated_prefix |
186 = make_relative_prefix (dummy, | 203 = make_relative_prefix (dummy, |
187 cpp_EXEC_PREFIX, | 204 cpp_EXEC_PREFIX, |
188 cpp_PREFIX); | 205 cpp_PREFIX); |
206 free (dummy); | |
189 } | 207 } |
190 str = concat (relocated_prefix, | 208 ostr = concat (relocated_prefix, |
191 p->fname + cpp_PREFIX_len, | 209 p->fname + cpp_PREFIX_len, |
192 NULL); | 210 NULL); |
193 str = update_path (str, p->component); | 211 str = update_path (ostr, p->component); |
212 free (ostr); | |
194 } | 213 } |
195 else | 214 else |
196 str = update_path (p->fname, p->component); | 215 str = update_path (p->fname, p->component); |
197 | 216 |
198 if (p->multilib && imultilib) | 217 if (p->multilib == 1 && imultilib) |
199 str = concat (str, dir_separator_str, imultilib, NULL); | 218 str = reconcat (str, str, dir_separator_str, imultilib, NULL); |
200 | 219 else if (p->multilib == 2) |
201 add_path (str, SYSTEM, p->cxx_aware, false); | 220 { |
221 if (!imultiarch) | |
222 { | |
223 free (str); | |
224 continue; | |
225 } | |
226 str = reconcat (str, str, dir_separator_str, imultiarch, NULL); | |
227 } | |
228 | |
229 add_path (str, INC_SYSTEM, p->cxx_aware, false); | |
202 } | 230 } |
203 } | 231 } |
204 } | 232 } |
205 | 233 |
206 /* For each duplicate path in chain HEAD, keep just the first one. | 234 /* For each duplicate path in chain HEAD, keep just the first one. |
224 | 252 |
225 cur = *pcur; | 253 cur = *pcur; |
226 | 254 |
227 if (stat (cur->name, &st)) | 255 if (stat (cur->name, &st)) |
228 { | 256 { |
229 /* Dirs that don't exist are silently ignored, unless verbose. */ | 257 /* Dirs that don't exist or have denied permissions are |
230 if (errno != ENOENT) | 258 silently ignored, unless verbose. */ |
259 if ((errno != ENOENT) && (errno != EPERM)) | |
231 cpp_errno (pfile, CPP_DL_ERROR, cur->name); | 260 cpp_errno (pfile, CPP_DL_ERROR, cur->name); |
232 else | 261 else |
233 { | 262 { |
234 /* If -Wmissing-include-dirs is given, warn. */ | 263 /* If -Wmissing-include-dirs is given, warn. */ |
235 cpp_options *opts = cpp_get_options (pfile); | 264 cpp_options *opts = cpp_get_options (pfile); |
236 if (opts->warn_missing_include_dirs && cur->user_supplied_p) | 265 if (opts->warn_missing_include_dirs && cur->user_supplied_p) |
237 cpp_errno (pfile, CPP_DL_WARNING, cur->name); | 266 cpp_warning (pfile, CPP_W_MISSING_INCLUDE_DIRS, "%s: %s", |
267 cur->name, xstrerror (errno)); | |
238 reason = REASON_NOENT; | 268 reason = REASON_NOENT; |
239 } | 269 } |
240 } | 270 } |
241 else if (!S_ISDIR (st.st_mode)) | 271 else if (!S_ISDIR (st.st_mode)) |
242 cpp_error_with_line (pfile, CPP_DL_WARNING, 0, 0, | 272 cpp_error_with_line (pfile, CPP_DL_WARNING, 0, 0, |
283 *pcur = join; | 313 *pcur = join; |
284 return head; | 314 return head; |
285 } | 315 } |
286 | 316 |
287 /* Add SYSROOT to any user-supplied paths in CHAIN starting with | 317 /* Add SYSROOT to any user-supplied paths in CHAIN starting with |
288 "=". */ | 318 "=" or "$SYSROOT". */ |
289 | 319 |
290 static void | 320 static void |
291 add_sysroot_to_chain (const char *sysroot, int chain) | 321 add_sysroot_to_chain (const char *sysroot, int chain) |
292 { | 322 { |
293 struct cpp_dir *p; | 323 struct cpp_dir *p; |
294 | 324 |
295 for (p = heads[chain]; p != NULL; p = p->next) | 325 for (p = heads[chain]; p != NULL; p = p->next) |
296 if (p->name[0] == '=' && p->user_supplied_p) | 326 { |
297 p->name = concat (sysroot, p->name + 1, NULL); | 327 if (p->user_supplied_p) |
328 { | |
329 if (p->name[0] == '=') | |
330 p->name = concat (sysroot, p->name + 1, NULL); | |
331 if (strncmp (p->name, "$SYSROOT", strlen ("$SYSROOT")) == 0) | |
332 p->name = concat (sysroot, p->name + strlen ("$SYSROOT"), NULL); | |
333 } | |
334 } | |
298 } | 335 } |
299 | 336 |
300 /* Merge the four include chains together in the order quote, bracket, | 337 /* Merge the four include chains together in the order quote, bracket, |
301 system, after. Remove duplicate dirs (determined in | 338 system, after. Remove duplicate dirs (determined in |
302 system-specific manner). | 339 system-specific manner). |
311 merge_include_chains (const char *sysroot, cpp_reader *pfile, int verbose) | 348 merge_include_chains (const char *sysroot, cpp_reader *pfile, int verbose) |
312 { | 349 { |
313 /* Add the sysroot to user-supplied paths starting with "=". */ | 350 /* Add the sysroot to user-supplied paths starting with "=". */ |
314 if (sysroot) | 351 if (sysroot) |
315 { | 352 { |
316 add_sysroot_to_chain (sysroot, QUOTE); | 353 add_sysroot_to_chain (sysroot, INC_QUOTE); |
317 add_sysroot_to_chain (sysroot, BRACKET); | 354 add_sysroot_to_chain (sysroot, INC_BRACKET); |
318 add_sysroot_to_chain (sysroot, SYSTEM); | 355 add_sysroot_to_chain (sysroot, INC_SYSTEM); |
319 add_sysroot_to_chain (sysroot, AFTER); | 356 add_sysroot_to_chain (sysroot, INC_AFTER); |
320 } | 357 } |
321 | 358 |
322 /* Join the SYSTEM and AFTER chains. Remove duplicates in the | 359 /* Join the SYSTEM and AFTER chains. Remove duplicates in the |
323 resulting SYSTEM chain. */ | 360 resulting SYSTEM chain. */ |
324 if (heads[SYSTEM]) | 361 if (heads[INC_SYSTEM]) |
325 tails[SYSTEM]->next = heads[AFTER]; | 362 tails[INC_SYSTEM]->next = heads[INC_AFTER]; |
326 else | 363 else |
327 heads[SYSTEM] = heads[AFTER]; | 364 heads[INC_SYSTEM] = heads[INC_AFTER]; |
328 heads[SYSTEM] = remove_duplicates (pfile, heads[SYSTEM], 0, 0, verbose); | 365 heads[INC_SYSTEM] |
366 = remove_duplicates (pfile, heads[INC_SYSTEM], 0, 0, verbose); | |
329 | 367 |
330 /* Remove duplicates from BRACKET that are in itself or SYSTEM, and | 368 /* Remove duplicates from BRACKET that are in itself or SYSTEM, and |
331 join it to SYSTEM. */ | 369 join it to SYSTEM. */ |
332 heads[BRACKET] = remove_duplicates (pfile, heads[BRACKET], heads[SYSTEM], | 370 heads[INC_BRACKET] |
333 heads[SYSTEM], verbose); | 371 = remove_duplicates (pfile, heads[INC_BRACKET], heads[INC_SYSTEM], |
372 heads[INC_SYSTEM], verbose); | |
334 | 373 |
335 /* Remove duplicates from QUOTE that are in itself or SYSTEM, and | 374 /* Remove duplicates from QUOTE that are in itself or SYSTEM, and |
336 join it to BRACKET. */ | 375 join it to BRACKET. */ |
337 heads[QUOTE] = remove_duplicates (pfile, heads[QUOTE], heads[SYSTEM], | 376 heads[INC_QUOTE] |
338 heads[BRACKET], verbose); | 377 = remove_duplicates (pfile, heads[INC_QUOTE], heads[INC_SYSTEM], |
378 heads[INC_BRACKET], verbose); | |
339 | 379 |
340 /* If verbose, print the list of dirs to search. */ | 380 /* If verbose, print the list of dirs to search. */ |
341 if (verbose) | 381 if (verbose) |
342 { | 382 { |
343 struct cpp_dir *p; | 383 struct cpp_dir *p; |
344 | 384 |
345 fprintf (stderr, _("#include \"...\" search starts here:\n")); | 385 fprintf (stderr, _("#include \"...\" search starts here:\n")); |
346 for (p = heads[QUOTE];; p = p->next) | 386 for (p = heads[INC_QUOTE];; p = p->next) |
347 { | 387 { |
348 if (p == heads[BRACKET]) | 388 if (p == heads[INC_BRACKET]) |
349 fprintf (stderr, _("#include <...> search starts here:\n")); | 389 fprintf (stderr, _("#include <...> search starts here:\n")); |
350 if (!p) | 390 if (!p) |
351 break; | 391 break; |
352 fprintf (stderr, " %s\n", p->name); | 392 fprintf (stderr, " %s\n", p->name); |
353 } | 393 } |
360 (Note that -I. -I- is not the same as the default setup; -I. uses | 400 (Note that -I. -I- is not the same as the default setup; -I. uses |
361 the compiler's working dir.) */ | 401 the compiler's working dir.) */ |
362 void | 402 void |
363 split_quote_chain (void) | 403 split_quote_chain (void) |
364 { | 404 { |
365 heads[QUOTE] = heads[BRACKET]; | 405 if (heads[INC_QUOTE]) |
366 tails[QUOTE] = tails[BRACKET]; | 406 free_path (heads[INC_QUOTE], REASON_QUIET); |
367 heads[BRACKET] = NULL; | 407 if (tails[INC_QUOTE]) |
368 tails[BRACKET] = NULL; | 408 free_path (tails[INC_QUOTE], REASON_QUIET); |
409 heads[INC_QUOTE] = heads[INC_BRACKET]; | |
410 tails[INC_QUOTE] = tails[INC_BRACKET]; | |
411 heads[INC_BRACKET] = NULL; | |
412 tails[INC_BRACKET] = NULL; | |
369 /* This is NOT redundant. */ | 413 /* This is NOT redundant. */ |
370 quote_ignores_source_dir = true; | 414 quote_ignores_source_dir = true; |
371 } | 415 } |
372 | 416 |
373 /* Add P to the chain specified by CHAIN. */ | 417 /* Add P to the chain specified by CHAIN. */ |
374 | 418 |
375 void | 419 void |
376 add_cpp_dir_path (cpp_dir *p, int chain) | 420 add_cpp_dir_path (cpp_dir *p, incpath_kind chain) |
377 { | 421 { |
378 if (tails[chain]) | 422 if (tails[chain]) |
379 tails[chain]->next = p; | 423 tails[chain]->next = p; |
380 else | 424 else |
381 heads[chain] = p; | 425 heads[chain] = p; |
383 } | 427 } |
384 | 428 |
385 /* Add PATH to the include chain CHAIN. PATH must be malloc-ed and | 429 /* Add PATH to the include chain CHAIN. PATH must be malloc-ed and |
386 NUL-terminated. */ | 430 NUL-terminated. */ |
387 void | 431 void |
388 add_path (char *path, int chain, int cxx_aware, bool user_supplied_p) | 432 add_path (char *path, incpath_kind chain, int cxx_aware, bool user_supplied_p) |
389 { | 433 { |
390 cpp_dir *p; | 434 cpp_dir *p; |
391 | 435 |
392 #if defined (HAVE_DOS_BASED_FILE_SYSTEM) | 436 #if defined (HAVE_DOS_BASED_FILE_SYSTEM) |
393 /* Remove unnecessary trailing slashes. On some versions of MS | 437 /* Remove unnecessary trailing slashes. On some versions of MS |
408 p->next = NULL; | 452 p->next = NULL; |
409 p->name = path; | 453 p->name = path; |
410 #ifndef INO_T_EQ | 454 #ifndef INO_T_EQ |
411 p->canonical_name = lrealpath (path); | 455 p->canonical_name = lrealpath (path); |
412 #endif | 456 #endif |
413 if (chain == SYSTEM || chain == AFTER) | 457 if (chain == INC_SYSTEM || chain == INC_AFTER) |
414 p->sysp = 1 + !cxx_aware; | 458 p->sysp = 1 + !cxx_aware; |
415 else | 459 else |
416 p->sysp = 0; | 460 p->sysp = 0; |
417 p->construct = 0; | 461 p->construct = 0; |
418 p->user_supplied_p = user_supplied_p; | 462 p->user_supplied_p = user_supplied_p; |
438 else | 482 else |
439 cxx_stdinc = false; | 483 cxx_stdinc = false; |
440 | 484 |
441 /* CPATH and language-dependent environment variables may add to the | 485 /* CPATH and language-dependent environment variables may add to the |
442 include chain. */ | 486 include chain. */ |
443 add_env_var_paths ("CPATH", BRACKET); | 487 add_env_var_paths ("CPATH", INC_BRACKET); |
444 add_env_var_paths (lang_env_vars[idx], SYSTEM); | 488 add_env_var_paths (lang_env_vars[idx], INC_SYSTEM); |
445 | 489 |
446 target_c_incpath.extra_pre_includes (sysroot, iprefix, stdinc); | 490 target_c_incpath.extra_pre_includes (sysroot, iprefix, stdinc); |
447 | 491 |
448 /* Finally chain on the standard directories. */ | 492 /* Finally chain on the standard directories. */ |
449 if (stdinc) | 493 if (stdinc) |
451 | 495 |
452 target_c_incpath.extra_includes (sysroot, iprefix, stdinc); | 496 target_c_incpath.extra_includes (sysroot, iprefix, stdinc); |
453 | 497 |
454 merge_include_chains (sysroot, pfile, verbose); | 498 merge_include_chains (sysroot, pfile, verbose); |
455 | 499 |
456 cpp_set_include_chains (pfile, heads[QUOTE], heads[BRACKET], | 500 cpp_set_include_chains (pfile, heads[INC_QUOTE], heads[INC_BRACKET], |
457 quote_ignores_source_dir); | 501 quote_ignores_source_dir); |
458 } | 502 } |
503 | |
504 /* Return the current chain of cpp dirs. */ | |
505 | |
506 struct cpp_dir * | |
507 get_added_cpp_dirs (incpath_kind chain) | |
508 { | |
509 return heads[chain]; | |
510 } | |
511 | |
459 #if !(defined TARGET_EXTRA_INCLUDES) || !(defined TARGET_EXTRA_PRE_INCLUDES) | 512 #if !(defined TARGET_EXTRA_INCLUDES) || !(defined TARGET_EXTRA_PRE_INCLUDES) |
460 static void hook_void_charptr_charptr_int (const char *sysroot ATTRIBUTE_UNUSED, | 513 static void hook_void_charptr_charptr_int (const char *sysroot ATTRIBUTE_UNUSED, |
461 const char *iprefix ATTRIBUTE_UNUSED, | 514 const char *iprefix ATTRIBUTE_UNUSED, |
462 int stdinc ATTRIBUTE_UNUSED) | 515 int stdinc ATTRIBUTE_UNUSED) |
463 { | 516 { |