Commit bdee42b1 by Neil Booth Committed by Neil Booth

cpperror.c (_cpp_begin_message): No special casing of CPP_FATAL_LIMIT.

	* cpperror.c (_cpp_begin_message): No special casing
	of CPP_FATAL_LIMIT.
	* cppinit.c (sanity_checks): s/DL_FATAL/DL_ICE/.
	(output_deps, cpp_handle_option, cpp_post_options): Use DL_ERROR.
	* cpplib.c (do_include_common): Use DL_ERROR.
	* cpplib.h (CPP_FATAL_LIMIT, CPP_FATAL_ERRORS, DL_FATAL): Remove.
	(DL_ICE): Renumber.
	* fix-header.c (read_scan_file): Update.

From-SVN: r53765
parent e67a7860
2002-05-23 Neil Booth <neil@daikokuya.demon.co.uk>
* cpperror.c (_cpp_begin_message): No special casing
of CPP_FATAL_LIMIT.
* cppinit.c (sanity_checks): s/DL_FATAL/DL_ICE/.
(output_deps, cpp_handle_option, cpp_post_options): Use DL_ERROR.
* cpplib.c (do_include_common): Use DL_ERROR.
* cpplib.h (CPP_FATAL_LIMIT, CPP_FATAL_ERRORS, DL_FATAL): Remove.
(DL_ICE): Renumber.
* fix-header.c (read_scan_file): Update.
2002-05-22 Richard Henderson <rth@redhat.com> 2002-05-22 Richard Henderson <rth@redhat.com>
* config/i386/i386.c (ix86_expand_call): New function, extracted * config/i386/i386.c (ix86_expand_call): New function, extracted
......
...@@ -92,7 +92,6 @@ _cpp_begin_message (pfile, code, line, column) ...@@ -92,7 +92,6 @@ _cpp_begin_message (pfile, code, line, column)
{ {
if (CPP_OPTION (pfile, inhibit_errors)) if (CPP_OPTION (pfile, inhibit_errors))
return 0; return 0;
if (pfile->errors < CPP_FATAL_LIMIT)
pfile->errors++; pfile->errors++;
} }
else if (CPP_OPTION (pfile, inhibit_warnings)) else if (CPP_OPTION (pfile, inhibit_warnings))
...@@ -102,14 +101,9 @@ _cpp_begin_message (pfile, code, line, column) ...@@ -102,14 +101,9 @@ _cpp_begin_message (pfile, code, line, column)
case DL_ERROR: case DL_ERROR:
if (CPP_OPTION (pfile, inhibit_errors)) if (CPP_OPTION (pfile, inhibit_errors))
return 0; return 0;
if (pfile->errors < CPP_FATAL_LIMIT) /* ICEs cannot be inhibited. */
pfile->errors++;
break;
/* Fatal errors cannot be inhibited. */
case DL_FATAL:
case DL_ICE: case DL_ICE:
pfile->errors = CPP_FATAL_LIMIT; pfile->errors++;
break; break;
} }
......
...@@ -845,31 +845,31 @@ static void sanity_checks (pfile) ...@@ -845,31 +845,31 @@ static void sanity_checks (pfile)
type precisions made by cpplib. */ type precisions made by cpplib. */
test--; test--;
if (test < 1) if (test < 1)
cpp_error (pfile, DL_FATAL, "cppchar_t must be an unsigned type"); cpp_error (pfile, DL_ICE, "cppchar_t must be an unsigned type");
if (CPP_OPTION (pfile, precision) > BITS_PER_HOST_WIDEST_INT) if (CPP_OPTION (pfile, precision) > BITS_PER_HOST_WIDEST_INT)
cpp_error (pfile, DL_FATAL, cpp_error (pfile, DL_ICE,
"preprocessor arithmetic has maximum precision of %lu bits; target requires %lu bits", "preprocessor arithmetic has maximum precision of %lu bits; target requires %lu bits",
(unsigned long)BITS_PER_HOST_WIDEST_INT, (unsigned long)BITS_PER_HOST_WIDEST_INT,
(unsigned long)CPP_OPTION (pfile, precision)); (unsigned long)CPP_OPTION (pfile, precision));
if (CPP_OPTION (pfile, precision) < CPP_OPTION (pfile, int_precision)) if (CPP_OPTION (pfile, precision) < CPP_OPTION (pfile, int_precision))
cpp_error (pfile, DL_FATAL, cpp_error (pfile, DL_ICE,
"CPP arithmetic must be at least as precise as a target int"); "CPP arithmetic must be at least as precise as a target int");
if (CPP_OPTION (pfile, char_precision) < 8) if (CPP_OPTION (pfile, char_precision) < 8)
cpp_error (pfile, DL_FATAL, "target char is less than 8 bits wide"); cpp_error (pfile, DL_ICE, "target char is less than 8 bits wide");
if (CPP_OPTION (pfile, wchar_precision) < CPP_OPTION (pfile, char_precision)) if (CPP_OPTION (pfile, wchar_precision) < CPP_OPTION (pfile, char_precision))
cpp_error (pfile, DL_FATAL, cpp_error (pfile, DL_ICE,
"target wchar_t is narrower than target char"); "target wchar_t is narrower than target char");
if (CPP_OPTION (pfile, int_precision) < CPP_OPTION (pfile, char_precision)) if (CPP_OPTION (pfile, int_precision) < CPP_OPTION (pfile, char_precision))
cpp_error (pfile, DL_FATAL, cpp_error (pfile, DL_ICE,
"target int is narrower than target char"); "target int is narrower than target char");
if (CPP_OPTION (pfile, wchar_precision) > BITS_PER_CPPCHAR_T) if (CPP_OPTION (pfile, wchar_precision) > BITS_PER_CPPCHAR_T)
cpp_error (pfile, DL_FATAL, cpp_error (pfile, DL_ICE,
"CPP on this host cannot handle wide character constants over %lu bits, but the target requires %lu bits", "CPP on this host cannot handle wide character constants over %lu bits, but the target requires %lu bits",
(unsigned long)BITS_PER_CPPCHAR_T, (unsigned long)BITS_PER_CPPCHAR_T,
(unsigned long)CPP_OPTION (pfile, wchar_precision)); (unsigned long)CPP_OPTION (pfile, wchar_precision));
...@@ -1061,7 +1061,7 @@ output_deps (pfile) ...@@ -1061,7 +1061,7 @@ output_deps (pfile)
if (deps_stream != stdout) if (deps_stream != stdout)
{ {
if (ferror (deps_stream) || fclose (deps_stream) != 0) if (ferror (deps_stream) || fclose (deps_stream) != 0)
cpp_error (pfile, DL_FATAL, "I/O error on output"); cpp_error (pfile, DL_ERROR, "I/O error on output");
} }
} }
...@@ -1300,7 +1300,7 @@ cpp_handle_option (pfile, argc, argv, ignore) ...@@ -1300,7 +1300,7 @@ cpp_handle_option (pfile, argc, argv, ignore)
else if (CPP_OPTION (pfile, out_fname) == NULL) else if (CPP_OPTION (pfile, out_fname) == NULL)
CPP_OPTION (pfile, out_fname) = argv[i]; CPP_OPTION (pfile, out_fname) = argv[i];
else else
cpp_error (pfile, DL_FATAL, cpp_error (pfile, DL_ERROR,
"too many filenames. Type %s --help for usage info", "too many filenames. Type %s --help for usage info",
progname); progname);
} }
...@@ -1328,7 +1328,7 @@ cpp_handle_option (pfile, argc, argv, ignore) ...@@ -1328,7 +1328,7 @@ cpp_handle_option (pfile, argc, argv, ignore)
arg = argv[++i]; arg = argv[++i];
if (!arg) if (!arg)
{ {
cpp_error (pfile, DL_FATAL, cpp_error (pfile, DL_ERROR,
cl_options[opt_index].msg, argv[i - 1]); cl_options[opt_index].msg, argv[i - 1]);
return argc; return argc;
} }
...@@ -1481,7 +1481,7 @@ cpp_handle_option (pfile, argc, argv, ignore) ...@@ -1481,7 +1481,7 @@ cpp_handle_option (pfile, argc, argv, ignore)
CPP_OPTION (pfile, out_fname) = arg; CPP_OPTION (pfile, out_fname) = arg;
else else
{ {
cpp_error (pfile, DL_FATAL, "output filename specified twice"); cpp_error (pfile, DL_ERROR, "output filename specified twice");
return argc; return argc;
} }
break; break;
...@@ -1592,7 +1592,7 @@ cpp_handle_option (pfile, argc, argv, ignore) ...@@ -1592,7 +1592,7 @@ cpp_handle_option (pfile, argc, argv, ignore)
} }
else else
{ {
cpp_error (pfile, DL_FATAL, "-I- specified twice"); cpp_error (pfile, DL_ERROR, "-I- specified twice");
return argc; return argc;
} }
} }
...@@ -1796,7 +1796,7 @@ cpp_post_options (pfile) ...@@ -1796,7 +1796,7 @@ cpp_post_options (pfile)
(CPP_OPTION (pfile, print_deps_missing_files) (CPP_OPTION (pfile, print_deps_missing_files)
|| CPP_OPTION (pfile, deps_file) || CPP_OPTION (pfile, deps_file)
|| CPP_OPTION (pfile, deps_phony_targets))) || CPP_OPTION (pfile, deps_phony_targets)))
cpp_error (pfile, DL_FATAL, cpp_error (pfile, DL_ERROR,
"you must additionally specify either -M or -MM"); "you must additionally specify either -M or -MM");
} }
......
...@@ -651,7 +651,7 @@ do_include_common (pfile, type) ...@@ -651,7 +651,7 @@ do_include_common (pfile, type)
{ {
/* Prevent #include recursion. */ /* Prevent #include recursion. */
if (pfile->line_maps.depth >= CPP_STACK_MAX) if (pfile->line_maps.depth >= CPP_STACK_MAX)
cpp_error (pfile, DL_FATAL, "#include nested too deeply"); cpp_error (pfile, DL_ERROR, "#include nested too deeply");
else else
{ {
check_eol (pfile); check_eol (pfile);
......
...@@ -420,10 +420,6 @@ struct cpp_callbacks ...@@ -420,10 +420,6 @@ struct cpp_callbacks
void (*register_builtins) PARAMS ((cpp_reader *)); void (*register_builtins) PARAMS ((cpp_reader *));
}; };
#define CPP_FATAL_LIMIT 1000
/* True if we have seen a "fatal" error. */
#define CPP_FATAL_ERRORS(PFILE) (cpp_errors (PFILE) >= CPP_FATAL_LIMIT)
/* Name under which this program was invoked. */ /* Name under which this program was invoked. */
extern const char *progname; extern const char *progname;
...@@ -593,13 +589,9 @@ extern int cpp_defined PARAMS ((cpp_reader *, const unsigned char *, int)); ...@@ -593,13 +589,9 @@ extern int cpp_defined PARAMS ((cpp_reader *, const unsigned char *, int));
#define DL_PEDWARN 0x02 #define DL_PEDWARN 0x02
/* An error. */ /* An error. */
#define DL_ERROR 0x03 #define DL_ERROR 0x03
/* A fatal error. We do not exit, to support use of cpplib as a
library, but may only return CPP_EOF tokens thereon. It is the
caller's responsibility to check CPP_FATAL_ERRORS. */
#define DL_FATAL 0x04
/* An internal consistency check failed. Prints "internal error: ", /* An internal consistency check failed. Prints "internal error: ",
otherwise the same as DL_FATAL. */ otherwise the same as DL_ERROR. */
#define DL_ICE 0x05 #define DL_ICE 0x04
/* Extracts a diagnostic level from an int. */ /* Extracts a diagnostic level from an int. */
#define DL_EXTRACT(l) (l & 0xf) #define DL_EXTRACT(l) (l & 0xf)
/* Non-zero if a diagnostic level is one of the warnings. */ /* Non-zero if a diagnostic level is one of the warnings. */
......
...@@ -632,10 +632,10 @@ read_scan_file (in_fname, argc, argv) ...@@ -632,10 +632,10 @@ read_scan_file (in_fname, argc, argv)
options->inhibit_errors = 1; options->inhibit_errors = 1;
i = cpp_handle_options (scan_in, argc, argv); i = cpp_handle_options (scan_in, argc, argv);
if (i < argc && ! CPP_FATAL_ERRORS (scan_in)) if (i < argc)
cpp_error (scan_in, DL_FATAL, "invalid option `%s'", argv[i]); cpp_error (scan_in, DL_ERROR, "invalid option `%s'", argv[i]);
cpp_post_options (scan_in); cpp_post_options (scan_in);
if (CPP_FATAL_ERRORS (scan_in)) if (cpp_errors (scan_in))
exit (FATAL_EXIT_CODE); exit (FATAL_EXIT_CODE);
if (! cpp_read_main_file (scan_in, in_fname, NULL)) if (! cpp_read_main_file (scan_in, in_fname, NULL))
......
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