diff options
author | Scott Wood <scottwood@freescale.com> | 2008-01-03 17:43:29 -0600 |
---|---|---|
committer | Jon Loeliger <jdl@freescale.com> | 2008-01-04 08:04:15 -0600 |
commit | f77fe6a20e75a2289faf86f9b6b529044a07b072 (patch) | |
tree | 3db42b3e19442e0af74954f860858e530b5d8653 /dtc-parser.y | |
parent | 3bb78bfd9758ff726ca80df2cb554a2f2df798a3 (diff) | |
download | dtc-f77fe6a20e75a2289faf86f9b6b529044a07b072.tar.gz |
Add yyerrorf() for formatted error messages.
Signed-off-by: Scott Wood <scottwood@freescale.com>
Diffstat (limited to 'dtc-parser.y')
-rw-r--r-- | dtc-parser.y | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/dtc-parser.y b/dtc-parser.y index 002ea7f..ddb7f27 100644 --- a/dtc-parser.y +++ b/dtc-parser.y @@ -307,15 +307,25 @@ label: %% -void yyerror (char const *s) +void yyerrorf(char const *s, ...) { const char *fname = srcpos_filename_for_num(yylloc.filenum); + va_list va; + va_start(va, s); if (strcmp(fname, "-") == 0) fname = "stdin"; - fprintf(stderr, "%s:%d %s\n", - fname, yylloc.first_line, s); + fprintf(stderr, "%s:%d ", fname, yylloc.first_line); + vfprintf(stderr, s, va); + fprintf(stderr, "\n"); + + va_end(va); +} + +void yyerror (char const *s) +{ + yyerrorf("%s", s); } unsigned long long eval_literal(const char *s, int base, int bits) |