From ebef4e8ca795b46b1f51a82d4b93c35f1eacd54c Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Sun, 14 Apr 2002 18:42:47 +0000 Subject: cpperror.c (print_location): Don't print include chain if line == 0. * cpperror.c (print_location): Don't print include chain if line == 0. (cpp_begin_message): Update to use DL_ macros. (cpp_ice, cpp_fatal, cpp_error_from_errno, cpp_warning, cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line, cpp_notice, cpp_notice_from_errno): Remove. (cpp_error, cpp_error_with_line): Update to take a diagnostic level. (cpp_errno): New. * cppexp.c (CPP_ICE): Remove. (SYNTAX_ERROR, SYNTAX_ERROR2, parse_number, parse_defined, lex, integer_overflow, _cpp_parse_expr): Update. * cppfiles.c (read_include_file, find_include_file, handle_missing_header, _cpp_read_file, remap_filename): Update. * cpphash.h (enum error_type): Remove. (_cpp_begin_message): Update. * cppinit.c (append_include_chain, remove_dup_dirs, output_deps, cpp_handle_option, cpp_post_options): Update. * cpplex.c (trigraph_p, skip_escaped_newlines, skip_block_comment, skip_whitespace, parse_identifier, parse_slow, parse_string, _cpp_lex_direct, cpp_spell_token, maybe_read_ucs, cpp_parse_escape, cpp_interpret_charconst): Update. * cpplib.c (check_eol, directive_diagnostics, _cpp_handle_directive, lex_macro_node, do_undef, glue_header_name, parse_include, do_include_common, read_flag, do_line, do_linemarker, do_ident, cpp_register_pragma, do_pragma_once, do_pragma_system_header, do_pragma_poison, do_pragma_dependency, _cpp_do__Pragma, do_else, do_elif, do_endif, parse_answer, parse_assertion, do_assert, _cpp_pop_buffer, do_diagnostic): Update. * cpplib.h (DL_WARNING, DL_WARNING_SYSHDR, DL_PEDWARN, DL_ERROR, DL_FATAL, DL_ICE, DL_EXTRACT, DL_WARNING_P): New. (cpp_ice, cpp_fatal, cpp_error_from_errno, cpp_warning, cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line, cpp_notice, cpp_notice_from_errno): Remove. (cpp_error, cpp_error_with_line): Update to take a diagnostic level. (cpp_errno): New. * cppmacro.c (builtin_macro, stringify_arg, paste_all_tokens, collect_args, enter_macro_context, save_parameter, parse_params, _cpp_create_definition, check_trad_stringification, cpp_macro_definition): Update. * cppmain.c (cpp_preprocess_file): Update. * fix-header.c (read_scan_file): Update. From-SVN: r52302 --- gcc/cppfiles.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'gcc/cppfiles.c') diff --git a/gcc/cppfiles.c b/gcc/cppfiles.c index 4c595a8..c1e6bfc 100644 --- a/gcc/cppfiles.c +++ b/gcc/cppfiles.c @@ -392,7 +392,7 @@ read_include_file (pfile, inc) does not bite us. */ if (inc->st.st_size > INTTYPE_MAXIMUM (ssize_t)) { - cpp_error (pfile, "%s is too large", inc->name); + cpp_error (pfile, DL_ERROR, "%s is too large", inc->name); goto fail; } size = inc->st.st_size; @@ -422,8 +422,8 @@ read_include_file (pfile, inc) if (count == 0) { if (!STAT_SIZE_TOO_BIG (inc->st)) - cpp_warning - (pfile, "%s is shorter than expected", inc->name); + cpp_error (pfile, DL_WARNING, + "%s is shorter than expected", inc->name); size = offset; buf = xrealloc (buf, size + 1); inc->st.st_size = size; @@ -437,7 +437,7 @@ read_include_file (pfile, inc) } else if (S_ISBLK (inc->st.st_mode)) { - cpp_error (pfile, "%s is a block device", inc->name); + cpp_error (pfile, DL_ERROR, "%s is a block device", inc->name); goto fail; } else @@ -473,7 +473,7 @@ read_include_file (pfile, inc) return 0; perror_fail: - cpp_error_from_errno (pfile, inc->name); + cpp_errno (pfile, DL_ERROR, inc->name); fail: return 1; } @@ -563,7 +563,8 @@ find_include_file (pfile, header, type) if (path == NULL) { - cpp_error (pfile, "no include path in which to find %s", fname); + cpp_error (pfile, DL_ERROR, "no include path in which to find %s", + fname); return NO_INCLUDE_PATH; } @@ -685,12 +686,10 @@ handle_missing_header (pfile, fname, angle_brackets) we can still produce correct output. Otherwise, we can't produce correct output, because there may be dependencies we need inside the missing file, and we don't know what directory this missing - file exists in. FIXME: Use a future cpp_diagnostic_with_errno () - for both of these cases. */ - else if (CPP_PRINT_DEPS (pfile) && ! print_dep) - cpp_warning (pfile, "%s: %s", fname, xstrerror (errno)); + file exists in. */ else - cpp_error_from_errno (pfile, fname); + cpp_errno (pfile, CPP_PRINT_DEPS (pfile) && ! print_dep + ? DL_WARNING: DL_ERROR, fname); } /* Handles #include-family directives (distinguished by TYPE), @@ -754,7 +753,7 @@ _cpp_read_file (pfile, fname) if (f == NULL) { - cpp_error_from_errno (pfile, fname); + cpp_errno (pfile, DL_ERROR, fname); return false; } @@ -1026,7 +1025,7 @@ remap_filename (pfile, name, loc) /* We know p != name as absolute paths don't call remap_filename. */ if (p == name) - cpp_ice (pfile, "absolute file name in remap_filename"); + cpp_error (pfile, DL_ICE, "absolute file name in remap_filename"); dir = (char *) alloca (p - name + 1); memcpy (dir, name, p - name); -- cgit v1.1