From b0866c745a3ef927f56b37fd500f302e5619264c Mon Sep 17 00:00:00 2001 From: Jim Wilson Date: Fri, 18 Mar 1994 12:35:42 -0800 Subject: [PATCH] (before_system, last_before_system): New variables. (main): Handle -isystem option. Insert -isystem directories in search chain at first_system_include. From-SVN: r6812 --- gcc/cccp.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/gcc/cccp.c b/gcc/cccp.c index 6a6b9f11ea0..506627326c3 100644 --- a/gcc/cccp.c +++ b/gcc/cccp.c @@ -619,6 +619,10 @@ static struct file_name_list *last_include = 0; /* Last in chain */ static struct file_name_list *after_include = 0; static struct file_name_list *last_after_include = 0; /* Last in chain */ +/* Chain to put at the start of the system include files. */ +static struct file_name_list *before_system = 0; +static struct file_name_list *last_before_system = 0; /* Last in chain */ + /* List of included files that contained #pragma once. */ static struct file_name_list *dont_repeat_files = 0; @@ -1177,6 +1181,27 @@ main (argc, argv) else include_prefix = argv[++i]; } + if (!strcmp (argv[i], "-isystem")) { + struct file_name_list *dirtmp; + + if (i + 1 == argc) + fatal ("Filename missing after `-isystem' option"); + + dirtmp = (struct file_name_list *) + xmalloc (sizeof (struct file_name_list)); + dirtmp->next = 0; + dirtmp->control_macro = 0; + dirtmp->c_system_include_path = 1; + dirtmp->fname = (char *) xmalloc (strlen (argv[i+1]) + 1); + strcpy (dirtmp->fname, argv[++i]); + dirtmp->got_name_map = 0; + + if (before_system == 0) + before_system = dirtmp; + else + last_before_system->next = dirtmp; + last_before_system = dirtmp; /* Tail follows the last one */ + } /* Add directory to end of path for includes, with the default prefix at the front of its name. */ if (!strcmp (argv[i], "-iwithprefix")) { @@ -1733,7 +1758,9 @@ main (argc, argv) } } - first_system_include = 0; + append_include_chain (before_system, last_before_system); + first_system_include = before_system; + /* Unless -fnostdinc, tack on the standard include file dirs to the specified list */ if (!no_standard_includes) { -- 2.30.2