diff options
author | bothner <bothner@138bc75d-0d04-0410-961f-82ee72b054a4> | 1996-06-07 03:04:54 +0000 |
---|---|---|
committer | bothner <bothner@138bc75d-0d04-0410-961f-82ee72b054a4> | 1996-06-07 03:04:54 +0000 |
commit | c6ea652694861230480e374b7cf8b8612019c472 (patch) | |
tree | 56c4ee50836b10971688c89220b2991fb083e29e /gcc/cpperror.c | |
parent | 26f471a761137387063ef272e8be5c0dd087b6ba (diff) | |
download | gcc-c6ea652694861230480e374b7cf8b8612019c472.tar.gz |
* cpperror.c (cpp_message): Generalize for "fatal" errors.
(cpp_fatal): New function (just calls cpp_message).
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@12201 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cpperror.c')
-rw-r--r-- | gcc/cpperror.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/gcc/cpperror.c b/gcc/cpperror.c index 5ba3b78f457..29bd9c8b85a 100644 --- a/gcc/cpperror.c +++ b/gcc/cpperror.c @@ -88,21 +88,38 @@ cpp_file_line_for_message (pfile, filename, line, column) fprintf (stderr, "%s:%d: ", filename, line); } -/* IS_ERROR is 1 for error, 0 for warning */ +/* IS_ERROR is 2 for "fatal" error, 1 for error, 0 for warning */ void cpp_message (pfile, is_error, msg, arg1, arg2, arg3) int is_error; cpp_reader *pfile; char *msg; char *arg1, *arg2, *arg3; { - if (is_error) - pfile->errors++; - else + if (!is_error) fprintf (stderr, "warning: "); + else if (is_error == 2) + pfile->errors = CPP_FATAL_LIMIT; + else if (pfile->errors < CPP_FATAL_LIMIT) + pfile->errors++; fprintf (stderr, msg, arg1, arg2, arg3); fprintf (stderr, "\n"); } +/* Same as cpp_error, except we consider the error to be "fatal", + such as inconsistent options. I.e. there is little point in continuing. + (We do not exit, to support use of cpplib as a library. + Instead, it is the caller's responsibility to check + CPP_FATAL_ERRORS. */ + +void +cpp_fatal (pfile, str, arg) + cpp_reader *pfile; + char *str, *arg; +{ + fprintf (stderr, "%s: ", progname); + cpp_message (pfile, 2, str, arg); +} + void fatal (str, arg) char *str, *arg; |