Commit 614c7d37 by Neil Booth Committed by Neil Booth

cppfiles.c (cpp_make_system_header): Take 2 booleans, and operate on current buffer.

        * cppfiles.c (cpp_make_system_header): Take 2 booleans,
        and operate on current buffer.
        (cpp_read_file): Rename _cpp_read_file.
        * cpplib.c (do_line, do_pragma_system_header): Update calls to
        cpp_make_system_header.
        * fix-header.c: Similarly.
        * cpphash.h (_cpp_read_file): Move from...
        * cpplib.h: ... here.
        * cppinit.c (do_includes, cpp_start_read): Update appropriately.

From-SVN: r37989
parent 2936419d
2000-12-04 Neil Booth <neilb@earthling.net>
* cppfiles.c (cpp_make_system_header): Take 2 booleans,
and operate on current buffer.
(cpp_read_file): Rename _cpp_read_file.
* cpplib.c (do_line, do_pragma_system_header): Update calls to
cpp_make_system_header.
* fix-header.c: Similarly.
* cpphash.h (_cpp_read_file): Move from...
* cpplib.h: ... here.
* cppinit.c (do_includes, cpp_start_read): Update appropriately.
2000-12-03 Kaveh R. Ghazi <ghazi@teal.rutgers.edu> 2000-12-03 Kaveh R. Ghazi <ghazi@teal.rutgers.edu>
* builtins.c (expand_builtin_strspn, expand_builtin_strcspn): * builtins.c (expand_builtin_strspn, expand_builtin_strcspn):
......
...@@ -526,17 +526,16 @@ _cpp_fake_include (pfile, fname) ...@@ -526,17 +526,16 @@ _cpp_fake_include (pfile, fname)
see the details of struct include_file. This is an exported interface see the details of struct include_file. This is an exported interface
because fix-header needs it. */ because fix-header needs it. */
void void
cpp_make_system_header (pfile, pbuf, flag) cpp_make_system_header (pfile, syshdr, externc)
cpp_reader *pfile; cpp_reader *pfile;
cpp_buffer *pbuf; int syshdr, externc;
int flag;
{ {
if (flag < 0 || flag > 2) int flags = 0;
cpp_ice (pfile, "cpp_make_system_header: bad flag %d\n", flag);
else if (!pbuf->inc) /* 1 = system header, 2 = system header to be treated as C. */
cpp_ice (pfile, "cpp_make_system_header called on non-file buffer"); if (syshdr)
else flags = 1 + (externc != 0);
pbuf->inc->sysp = flag; pfile->buffer->inc->sysp = flags;
} }
/* Report on all files that might benefit from a multiple include guard. /* Report on all files that might benefit from a multiple include guard.
...@@ -714,7 +713,7 @@ _cpp_compare_file_date (pfile, f) ...@@ -714,7 +713,7 @@ _cpp_compare_file_date (pfile, f)
/* Push an input buffer and load it up with the contents of FNAME. /* Push an input buffer and load it up with the contents of FNAME.
If FNAME is "" or NULL, read standard input. */ If FNAME is "" or NULL, read standard input. */
int int
cpp_read_file (pfile, fname) _cpp_read_file (pfile, fname)
cpp_reader *pfile; cpp_reader *pfile;
const char *fname; const char *fname;
{ {
......
...@@ -224,6 +224,7 @@ extern cpp_hashnode *_cpp_lookup_with_hash PARAMS ((cpp_reader*, size_t, ...@@ -224,6 +224,7 @@ extern cpp_hashnode *_cpp_lookup_with_hash PARAMS ((cpp_reader*, size_t,
/* In cppfiles.c */ /* In cppfiles.c */
extern void _cpp_simplify_pathname PARAMS ((char *)); extern void _cpp_simplify_pathname PARAMS ((char *));
extern int _cpp_read_file PARAMS ((cpp_reader *, const char *));
extern void _cpp_execute_include PARAMS ((cpp_reader *, extern void _cpp_execute_include PARAMS ((cpp_reader *,
const cpp_token *, int, const cpp_token *, int,
struct file_name_list *)); struct file_name_list *));
......
...@@ -931,7 +931,7 @@ do_includes (pfile, p, scan) ...@@ -931,7 +931,7 @@ do_includes (pfile, p, scan)
/* Later: maybe update this to use the #include "" search path /* Later: maybe update this to use the #include "" search path
if cpp_read_file fails. */ if cpp_read_file fails. */
if (cpp_read_file (pfile, p->arg) && scan) if (_cpp_read_file (pfile, p->arg) && scan)
cpp_scan_buffer_nooutput (pfile, 0); cpp_scan_buffer_nooutput (pfile, 0);
q = p->next; q = p->next;
free (p); free (p);
...@@ -1002,7 +1002,7 @@ cpp_start_read (pfile, fname) ...@@ -1002,7 +1002,7 @@ cpp_start_read (pfile, fname)
if (CPP_OPTION (pfile, out_fname) == NULL) if (CPP_OPTION (pfile, out_fname) == NULL)
CPP_OPTION (pfile, out_fname) = ""; CPP_OPTION (pfile, out_fname) = "";
if (!cpp_read_file (pfile, fname)) if (!_cpp_read_file (pfile, fname))
return 0; return 0;
initialize_dependency_output (pfile); initialize_dependency_output (pfile);
......
...@@ -771,23 +771,23 @@ do_line (pfile) ...@@ -771,23 +771,23 @@ do_line (pfile)
if (action_number == 1) if (action_number == 1)
{ {
reason = FC_ENTER; reason = FC_ENTER;
cpp_make_system_header (pfile, buffer, 0); cpp_make_system_header (pfile, 0, 0);
read_line_number (pfile, &action_number); read_line_number (pfile, &action_number);
} }
else if (action_number == 2) else if (action_number == 2)
{ {
reason = FC_LEAVE; reason = FC_LEAVE;
cpp_make_system_header (pfile, buffer, 0); cpp_make_system_header (pfile, 0, 0);
read_line_number (pfile, &action_number); read_line_number (pfile, &action_number);
} }
if (action_number == 3) if (action_number == 3)
{ {
cpp_make_system_header (pfile, buffer, 1); cpp_make_system_header (pfile, 1, 0);
read_line_number (pfile, &action_number); read_line_number (pfile, &action_number);
} }
if (action_number == 4) if (action_number == 4)
{ {
cpp_make_system_header (pfile, buffer, 2); cpp_make_system_header (pfile, 1, 1);
read_line_number (pfile, &action_number); read_line_number (pfile, &action_number);
} }
} }
...@@ -1100,11 +1100,12 @@ static void ...@@ -1100,11 +1100,12 @@ static void
do_pragma_system_header (pfile) do_pragma_system_header (pfile)
cpp_reader *pfile; cpp_reader *pfile;
{ {
cpp_buffer *ip = CPP_BUFFER (pfile); cpp_buffer *buffer = pfile->buffer;
if (CPP_PREV_BUFFER (ip) == NULL)
cpp_warning (pfile, "#pragma system_header outside include file"); if (buffer->prev == 0)
cpp_warning (pfile, "#pragma system_header ignored outside include file");
else else
cpp_make_system_header (pfile, ip, 1); cpp_make_system_header (pfile, 1, 0);
check_eol (pfile); check_eol (pfile);
} }
......
...@@ -781,8 +781,7 @@ extern void cpp_stop_lookahead PARAMS ((cpp_reader *, int)); ...@@ -781,8 +781,7 @@ extern void cpp_stop_lookahead PARAMS ((cpp_reader *, int));
/* In cppfiles.c */ /* In cppfiles.c */
extern int cpp_included PARAMS ((cpp_reader *, const char *)); extern int cpp_included PARAMS ((cpp_reader *, const char *));
extern int cpp_read_file PARAMS ((cpp_reader *, const char *)); extern void cpp_make_system_header PARAMS ((cpp_reader *, int, int));
extern void cpp_make_system_header PARAMS ((cpp_reader *, cpp_buffer *, int));
/* These are inline functions instead of macros so we can get type /* These are inline functions instead of macros so we can get type
checking. */ checking. */
......
...@@ -636,7 +636,7 @@ read_scan_file (in_fname, argc, argv) ...@@ -636,7 +636,7 @@ read_scan_file (in_fname, argc, argv)
exit (FATAL_EXIT_CODE); exit (FATAL_EXIT_CODE);
/* We are scanning a system header, so mark it as such. */ /* We are scanning a system header, so mark it as such. */
cpp_make_system_header (scan_in, CPP_BUFFER (scan_in), 1); cpp_make_system_header (scan_in, 1, 0);
scan_decls (scan_in, argc, argv); scan_decls (scan_in, argc, argv);
for (cur_symbols = &symbol_table[0]; cur_symbols->names; cur_symbols++) for (cur_symbols = &symbol_table[0]; cur_symbols->names; cur_symbols++)
......
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