@@ -619,6 +619,10 @@ static struct file_name_list *last_include = 0; /* Last in chain */
619
619
static struct file_name_list * after_include = 0 ;
620
620
static struct file_name_list * last_after_include = 0 ; /* Last in chain */
621
621
622
+ /* Chain to put at the start of the system include files. */
623
+ static struct file_name_list * before_system = 0 ;
624
+ static struct file_name_list * last_before_system = 0 ; /* Last in chain */
625
+
622
626
/* List of included files that contained #pragma once. */
623
627
static struct file_name_list * dont_repeat_files = 0 ;
624
628
@@ -1177,6 +1181,27 @@ main (argc, argv)
1177
1181
else
1178
1182
include_prefix = argv [++ i ];
1179
1183
}
1184
+ if (!strcmp (argv [i ], "-isystem" )) {
1185
+ struct file_name_list * dirtmp ;
1186
+
1187
+ if (i + 1 == argc )
1188
+ fatal ("Filename missing after `-isystem' option" );
1189
+
1190
+ dirtmp = (struct file_name_list * )
1191
+ xmalloc (sizeof (struct file_name_list ));
1192
+ dirtmp -> next = 0 ;
1193
+ dirtmp -> control_macro = 0 ;
1194
+ dirtmp -> c_system_include_path = 1 ;
1195
+ dirtmp -> fname = (char * ) xmalloc (strlen (argv [i + 1 ]) + 1 );
1196
+ strcpy (dirtmp -> fname , argv [++ i ]);
1197
+ dirtmp -> got_name_map = 0 ;
1198
+
1199
+ if (before_system == 0 )
1200
+ before_system = dirtmp ;
1201
+ else
1202
+ last_before_system -> next = dirtmp ;
1203
+ last_before_system = dirtmp ; /* Tail follows the last one */
1204
+ }
1180
1205
/* Add directory to end of path for includes,
1181
1206
with the default prefix at the front of its name. */
1182
1207
if (!strcmp (argv [i ], "-iwithprefix" )) {
@@ -1733,7 +1758,9 @@ main (argc, argv)
1733
1758
}
1734
1759
}
1735
1760
1736
- first_system_include = 0 ;
1761
+ append_include_chain (before_system , last_before_system );
1762
+ first_system_include = before_system ;
1763
+
1737
1764
/* Unless -fnostdinc,
1738
1765
tack on the standard include file dirs to the specified list */
1739
1766
if (!no_standard_includes ) {
0 commit comments