diff options
author | Neil Booth <neilb@earthling.net> | 2000-09-24 10:42:09 +0000 |
---|---|---|
committer | Neil Booth <neil@gcc.gnu.org> | 2000-09-24 10:42:09 +0000 |
commit | 838f313bbdf80d22aca1751d272efc3c58c2b870 (patch) | |
tree | cc48c49fb97eab0d2417c46c7dfcc7a7a9fb8e95 /gcc/cpplib.c | |
parent | c5412f0646a072dde262a8643ee2494fd55884eb (diff) | |
download | gcc-838f313bbdf80d22aca1751d272efc3c58c2b870.zip gcc-838f313bbdf80d22aca1751d272efc3c58c2b870.tar.gz gcc-838f313bbdf80d22aca1751d272efc3c58c2b870.tar.bz2 |
cpplex.c: Update TODO comment.
* cpplex.c: Update TODO comment.
* cpplib.c (do_error, do_warning): Merge common code of
do_error and do_warning into do_diagnostic. Use it.
(do_diagnostic): New function.
* cpplib.h: Fix comment typo.
From-SVN: r36587
Diffstat (limited to 'gcc/cpplib.c')
-rw-r--r-- | gcc/cpplib.c | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/gcc/cpplib.c b/gcc/cpplib.c index 8c61ab0..d6fcf9bf 100644 --- a/gcc/cpplib.c +++ b/gcc/cpplib.c @@ -52,7 +52,7 @@ static void push_conditional PARAMS ((cpp_reader *, int, int, static int read_line_number PARAMS ((cpp_reader *, int *)); static int strtoul_for_line PARAMS ((const U_CHAR *, unsigned int, unsigned long *)); - +static void do_diagnostic PARAMS ((cpp_reader *, enum error_type)); static const cpp_hashnode * parse_ifdef PARAMS ((cpp_reader *, const U_CHAR *)); static const cpp_hashnode * @@ -583,16 +583,16 @@ do_line (pfile) } /* - * Report an error detected by the program we are processing. - * Use the text of the line in the error message. - * (We use error because it prints the filename & line#.) + * Report a warning or error detected by the program we are + * processing. Use the directive's tokens in the error message. */ static void -do_error (pfile) +do_diagnostic (pfile, code) cpp_reader *pfile; + enum error_type code; { - if (_cpp_begin_message (pfile, ERROR, NULL, 0, 0)) + if (_cpp_begin_message (pfile, code, NULL, 0, 0)) { cpp_output_list (pfile, stderr, &pfile->token_list, pfile->first_directive_token); @@ -600,21 +600,18 @@ do_error (pfile) } } -/* - * Report a warning detected by the program we are processing. - * Use the text of the line in the warning message, then continue. - */ +static void +do_error (pfile) + cpp_reader *pfile; +{ + do_diagnostic (pfile, ERROR); +} static void do_warning (pfile) cpp_reader *pfile; { - if (_cpp_begin_message (pfile, WARNING, NULL, 0, 0)) - { - cpp_output_list (pfile, stderr, &pfile->token_list, - pfile->first_directive_token); - putc ('\n', stderr); - } + do_diagnostic (pfile, WARNING); } /* Report program identification. */ |