summaryrefslogtreecommitdiff
path: root/gcc/cppfiles.c
diff options
context:
space:
mode:
authorZack Weinberg <zack@gcc.gnu.org>2000-08-02 01:13:45 +0000
committerZack Weinberg <zack@gcc.gnu.org>2000-08-02 01:13:45 +0000
commit58fea6afd912f7c309c156522391b20462372ceb (patch)
treeaf945d1943c9c6b458fec03b961f8f0d523896bf /gcc/cppfiles.c
parent8cd8f856b33bbd6c6627eb0a18e34b046e2163f1 (diff)
downloadgcc-58fea6afd912f7c309c156522391b20462372ceb.tar.gz
cpperror.c (v_message): Split into _cpp_begin_message and v_message macro.
* cpperror.c (v_message): Split into _cpp_begin_message and v_message macro. All callers updated. (_cpp_begin_message): Do inhibit_errors/inhibit_warnings checks here. * cppfiles.c (cpp_syshdr_flags): New function. (read_include_file): Don't call cpp_output_tokens. Call enter_file hook. * cppinit.c (dump_macros_helper): Moved to cppmain.c. (cpp_reader_init): Don't initialize token_buffer. Call _cpp_init_internal_pragmas. (cpp_cleanup): Don't clear token_buffer. (cpp_start_read): Don't worry about output from -D processing. Don't call cpp_output_tokens. (cpp_finish): Don't dump macros here. Don't call cpp_output_tokens. * cppmacro.c (_cpp_dump_definition): Rename cpp_dump_definition. Write directly to a FILE *. (dump_funlike_macro): Delete. (dump_macro_args): New. * cpplex.c (TOKEN_LEN): Convert to inline function. (_cpp_grow_token_buffer, safe_fwrite, cpp_output_tokens, cpp_scan_line, _cpp_dump_list): Delete. (cpp_printf, cpp_output_list): New. (output_line_command): Don't worry about entering or leaving files. (cpp_scan_buffer): Just output each token as we hit it. (process_directive): Don't call cpp_output_tokens. (_cpp_glue_header_name): Don't use token_buffer. (output_token, dump_param_spelling): Write directly to a FILE *. * cpplib.c (pass_thru_directive, dump_macro_name, pragma_dispatch, do_pragma_gcc): Delete. (do_define, do_undef, parse_include, do_line, do_ident, do_pragma, do_pragma_poison, cpp_pop_buffer): Call the appropriate hook functions. (do_error, do_warning, pragma_dependency): Call _cpp_begin_message, then cpp_output_list. (cpp_register_pragma, cpp_register_pragma_space, _cpp_init_internal_pragmas): New. (do_pragma): Walk the pragmas table here. (do_pragma_once, do_pragma_poison, do_pragma_system_header, do_pragma_dependency): Return void. (do_pragma_implementation): Moved to cppmain.c. * cpplib.h: Update prototypes. (struct cpp_reader): Remove printer, token_buffer, token_buffer_size, and limit. Add struct cb, and pragmas. (struct cpp_printer): Remove last_id and written. (CPP_WRITTEN, CPP_PWRITTEN, CPP_SET_WRITTEN, CPP_ADJUST_WRITTEN): Delete. * cpphash.h: Update prototypes. (ufputs): New wrapper. * cppmain.c (cb_define, cb_undef, cb_include, cb_ident, cb_enter_file, cb_leave_file, cb_def_pragma): New functions. (main): Set up callbacks. Register #pragma implementation. Dump macros from here. From-SVN: r35415
Diffstat (limited to 'gcc/cppfiles.c')
-rw-r--r--gcc/cppfiles.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/gcc/cppfiles.c b/gcc/cppfiles.c
index fe9f0262e3b..2a8f01c3835 100644
--- a/gcc/cppfiles.c
+++ b/gcc/cppfiles.c
@@ -370,6 +370,20 @@ cpp_make_system_header (pfile, pbuf, flag)
pbuf->inc->sysp = flag;
}
+const char *
+cpp_syshdr_flags (pfile, pbuf)
+ cpp_reader *pfile ATTRIBUTE_UNUSED;
+ cpp_buffer *pbuf;
+{
+#ifndef NO_IMPLICIT_EXTERN_C
+ if (CPP_OPTION (pfile, cplusplus) && pbuf->inc->sysp == 2)
+ return " 3 4";
+#endif
+ if (pbuf->inc->sysp)
+ return " 3";
+ return "";
+}
+
/* Report on all files that might benefit from a multiple include guard.
Triggered by -H. */
void
@@ -594,11 +608,6 @@ read_include_file (pfile, inc)
cpp_buffer *fp;
int fd = inc->fd;
- /* Ensures we dump our current line before entering an include file. */
- if (CPP_BUFFER (pfile) && pfile->printer)
- cpp_output_tokens (pfile, pfile->printer,
- CPP_BUF_LINE (CPP_BUFFER (pfile)));
-
fp = cpp_push_buffer (pfile, NULL, 0);
if (fp == 0)
@@ -683,6 +692,8 @@ read_include_file (pfile, inc)
fp->actual_dir = actual_directory (pfile, inc->name);
pfile->input_stack_listing_current = 0;
+ if (pfile->cb.enter_file)
+ (*pfile->cb.enter_file) (pfile);
return 1;
perror_fail: