diff options
author | rsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-06-10 20:21:59 +0000 |
---|---|---|
committer | rsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-06-10 20:21:59 +0000 |
commit | b638f5c89f99cde8200a4af4de2ebf32f1c4d62c (patch) | |
tree | 2e3c136c636393db4c15e2660800e0141d0d6d70 /gcc/read-md.c | |
parent | b3453c30d65f1279208412f31c2ee423982c56a7 (diff) | |
download | gcc-b638f5c89f99cde8200a4af4de2ebf32f1c4d62c.tar.gz |
gcc/
* Makefile.in (build/read-md.o): Depend on errors.h.
* read-md.h (error_with_line): Declare.
* read-md.c: Include errors.h.
(message_with_line_1): New function, extracted from...
(message_with_line): ...here.
(error_with_line): New function.
* genattrtab.c: If a call to message_with_line is followed by
"have_error = 1;", replace both statements with a call to
error_with_line.
* genoutput.c: Likewise.
* genpreds.c: Likewise.
* genrecog.c: If a call to message_with_line is followed by
"error_count++;", replace both statements with a call to
error_with_line.
(errorcount): Delete.
(main): Don't check it.
* gensupport.c: If a call to message_with_line is followed by
"errors = 1;", replace both statements with a call to error_with_line.
(errors): Delete.
(process_define_cond_exec): Check have_error instead of errors.
(init_md_reader_args_cb): Likewise. Don't set errors.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160573 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/read-md.c')
-rw-r--r-- | gcc/read-md.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/gcc/read-md.c b/gcc/read-md.c index a8c0d5c251e..654e625d194 100644 --- a/gcc/read-md.c +++ b/gcc/read-md.c @@ -23,6 +23,7 @@ along with GCC; see the file COPYING3. If not see #include "system.h" #include "coretypes.h" #include "hashtab.h" +#include "errors.h" #include "read-md.h" /* Associates PTR (which can be a string, etc.) with the file location @@ -174,6 +175,17 @@ print_c_condition (const char *cond) } } +/* A vfprintf-like function for reporting an error against line LINENO + of the current MD file. */ + +static void ATTRIBUTE_PRINTF(2,0) +message_with_line_1 (int lineno, const char *msg, va_list ap) +{ + fprintf (stderr, "%s:%d: ", read_md_filename, lineno); + vfprintf (stderr, msg, ap); + fputc ('\n', stderr); +} + /* A printf-like function for reporting an error against line LINENO in the current MD file. */ @@ -183,12 +195,21 @@ message_with_line (int lineno, const char *msg, ...) va_list ap; va_start (ap, msg); + message_with_line_1 (lineno, msg, ap); + va_end (ap); +} - fprintf (stderr, "%s:%d: ", read_md_filename, lineno); - vfprintf (stderr, msg, ap); - fputc ('\n', stderr); +/* Like message_with_line, but treat the condition as an error. */ + +void +error_with_line (int lineno, const char *msg, ...) +{ + va_list ap; + va_start (ap, msg); + message_with_line_1 (lineno, msg, ap); va_end (ap); + have_error = 1; } /* A printf-like function for reporting an error against the current |