Commit d2a22862 by Richard Stallman

(struct file_name_list): Add new field c_system_include_path.

(*various*): Set this flag correctly
(is_system_include): Return 2 if C-language system include.
(output_line_command): Output " 4" after " 3" for C-language system
include.

From-SVN: r5659
parent 9eb91772
...@@ -540,6 +540,9 @@ struct file_name_list ...@@ -540,6 +540,9 @@ struct file_name_list
/* If the following is nonzero, it is a macro name. /* If the following is nonzero, it is a macro name.
Don't include the file again if that macro is defined. */ Don't include the file again if that macro is defined. */
U_CHAR *control_macro; U_CHAR *control_macro;
/* If the following is nonzero, it is a C-language system include
directory. */
int c_system_include_path;
}; };
/* #include "file" looks in source file dir, then stack. */ /* #include "file" looks in source file dir, then stack. */
...@@ -1121,6 +1124,7 @@ main (argc, argv) ...@@ -1121,6 +1124,7 @@ main (argc, argv)
xmalloc (sizeof (struct file_name_list)); xmalloc (sizeof (struct file_name_list));
dirtmp->next = 0; /* New one goes on the end */ dirtmp->next = 0; /* New one goes on the end */
dirtmp->control_macro = 0; dirtmp->control_macro = 0;
dirtmp->c_system_include_path = 0;
if (i + 1 == argc) if (i + 1 == argc)
fatal ("Directory name missing after `-iwithprefix' option"); fatal ("Directory name missing after `-iwithprefix' option");
...@@ -1154,6 +1158,7 @@ main (argc, argv) ...@@ -1154,6 +1158,7 @@ main (argc, argv)
xmalloc (sizeof (struct file_name_list)); xmalloc (sizeof (struct file_name_list));
dirtmp->next = 0; /* New one goes on the end */ dirtmp->next = 0; /* New one goes on the end */
dirtmp->control_macro = 0; dirtmp->control_macro = 0;
dirtmp->c_system_include_path = 0;
if (i + 1 == argc) if (i + 1 == argc)
fatal ("Directory name missing after `-iwithprefixbefore' option"); fatal ("Directory name missing after `-iwithprefixbefore' option");
...@@ -1172,6 +1177,7 @@ main (argc, argv) ...@@ -1172,6 +1177,7 @@ main (argc, argv)
xmalloc (sizeof (struct file_name_list)); xmalloc (sizeof (struct file_name_list));
dirtmp->next = 0; /* New one goes on the end */ dirtmp->next = 0; /* New one goes on the end */
dirtmp->control_macro = 0; dirtmp->control_macro = 0;
dirtmp->c_system_include_path = 0;
if (i + 1 == argc) if (i + 1 == argc)
fatal ("Directory name missing after `-idirafter' option"); fatal ("Directory name missing after `-idirafter' option");
else else
...@@ -1421,6 +1427,7 @@ main (argc, argv) ...@@ -1421,6 +1427,7 @@ main (argc, argv)
xmalloc (sizeof (struct file_name_list)); xmalloc (sizeof (struct file_name_list));
dirtmp->next = 0; /* New one goes on the end */ dirtmp->next = 0; /* New one goes on the end */
dirtmp->control_macro = 0; dirtmp->control_macro = 0;
dirtmp->c_system_include_path = 0;
if (argv[i][2] != 0) if (argv[i][2] != 0)
dirtmp->fname = argv[i] + 2; dirtmp->fname = argv[i] + 2;
else if (i + 1 == argc) else if (i + 1 == argc)
...@@ -1684,6 +1691,7 @@ main (argc, argv) ...@@ -1684,6 +1691,7 @@ main (argc, argv)
strcat (str, p->fname + default_len); strcat (str, p->fname + default_len);
new->fname = str; new->fname = str;
new->control_macro = 0; new->control_macro = 0;
new->c_system_include_path = !p->cplusplus;
append_include_chain (new, new); append_include_chain (new, new);
if (first_system_include == 0) if (first_system_include == 0)
first_system_include = new; first_system_include = new;
...@@ -1697,6 +1705,7 @@ main (argc, argv) ...@@ -1697,6 +1705,7 @@ main (argc, argv)
struct file_name_list *new struct file_name_list *new
= (struct file_name_list *) xmalloc (sizeof (struct file_name_list)); = (struct file_name_list *) xmalloc (sizeof (struct file_name_list));
new->control_macro = 0; new->control_macro = 0;
new->c_system_include_path = !p->cplusplus;
new->fname = p->fname; new->fname = p->fname;
append_include_chain (new, new); append_include_chain (new, new);
if (first_system_include == 0) if (first_system_include == 0)
...@@ -2015,6 +2024,7 @@ path_include (path) ...@@ -2015,6 +2024,7 @@ path_include (path)
xmalloc (sizeof (struct file_name_list)); xmalloc (sizeof (struct file_name_list));
dirtmp->next = 0; /* New one goes on the end */ dirtmp->next = 0; /* New one goes on the end */
dirtmp->control_macro = 0; dirtmp->control_macro = 0;
dirtmp->c_system_include_path = 0;
dirtmp->fname = name; dirtmp->fname = name;
append_include_chain (dirtmp, dirtmp); append_include_chain (dirtmp, dirtmp);
...@@ -4094,6 +4104,7 @@ get_filename: ...@@ -4094,6 +4104,7 @@ get_filename:
ptr = (struct file_name_list *) xmalloc (sizeof (struct file_name_list)); ptr = (struct file_name_list *) xmalloc (sizeof (struct file_name_list));
ptr->control_macro = 0; ptr->control_macro = 0;
ptr->c_system_include_path = 0;
ptr->next = all_include_files; ptr->next = all_include_files;
all_include_files = ptr; all_include_files = ptr;
ptr->fname = savestring (fname); ptr->fname = savestring (fname);
...@@ -4203,7 +4214,12 @@ is_system_include (filename) ...@@ -4203,7 +4214,12 @@ is_system_include (filename)
register unsigned length = strlen (sys_dir); register unsigned length = strlen (sys_dir);
if (! strncmp (sys_dir, filename, length) && filename[length] == '/') if (! strncmp (sys_dir, filename, length) && filename[length] == '/')
return 1; {
if (searchptr->c_system_include_path)
return 2;
else
return 1;
}
} }
return 0; return 0;
} }
...@@ -6099,6 +6115,7 @@ do_once () ...@@ -6099,6 +6115,7 @@ do_once ()
dont_repeat_files = new; dont_repeat_files = new;
new->fname = savestring (ip->fname); new->fname = savestring (ip->fname);
new->control_macro = 0; new->control_macro = 0;
new->c_system_include_path = 0;
} }
return 0; return 0;
} }
...@@ -7088,6 +7105,11 @@ output_line_command (ip, op, conditional, file_change) ...@@ -7088,6 +7105,11 @@ output_line_command (ip, op, conditional, file_change)
*line_end++ = ' '; *line_end++ = ' ';
*line_end++ = '3'; *line_end++ = '3';
} }
/* Tell cc1plus if following text should be treated as C. */
if (ip->system_header_p == 2) {
*line_end++ = ' ';
*line_end++ = '4';
}
*line_end++ = '\n'; *line_end++ = '\n';
len = line_end - line_cmd_buf; len = line_end - line_cmd_buf;
check_expand (op, len + 1); check_expand (op, len + 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment