diff options
author | Jon Loeliger <jdl@jdl.com> | 2008-09-12 13:39:49 -0500 |
---|---|---|
committer | Jon Loeliger <jdl@jdl.com> | 2008-10-03 15:38:08 -0500 |
commit | e5c8e1dcd7f2d3784194498e5ea916e7b48fe33a (patch) | |
tree | e764fa389f36895c055744b4be39de1c3127bdf3 /dtc-parser.y | |
parent | 83ac55d9c4669397f3f2454d3c72dd34e5de5490 (diff) | |
download | device-tree-compiler-e5c8e1dcd7f2d3784194498e5ea916e7b48fe33a.tar.gz |
Enhance source position implementation.
Implemented some print and copy routines.
Made empty srcpos objects that will be used later.
Protected .h file from multiple #include's.
Added srcpos_error() and srcpos_warn().
Signed-off-by: Jon Loeliger <jdl@freescale.com>
Diffstat (limited to 'dtc-parser.y')
-rw-r--r-- | dtc-parser.y | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/dtc-parser.y b/dtc-parser.y index b2ab562..ae6f3c4 100644 --- a/dtc-parser.y +++ b/dtc-parser.y @@ -27,6 +27,7 @@ #include "srcpos.h" extern int yylex(void); +extern void yyerror(char const *s); extern struct boot_info *the_boot_info; extern int treesource_error; @@ -208,9 +209,11 @@ propdata: if ($6 != 0) if (fseek(file->file, $6, SEEK_SET) != 0) - yyerrorf("Couldn't seek to offset %llu in \"%s\": %s", - (unsigned long long)$6, - $4.val, strerror(errno)); + srcpos_error(&yyloc, + "Couldn't seek to offset %llu in \"%s\": %s", + (unsigned long long)$6, + $4.val, + strerror(errno)); d = data_copy_file(file->file, $8); @@ -339,26 +342,10 @@ label: %% -void yyerrorf(char const *s, ...) +void yyerror(char const *s) { - const char *fname = srcpos_file ? srcpos_file->name : "<no-file>"; - va_list va; - va_start(va, s); - - if (strcmp(fname, "-") == 0) - fname = "stdin"; - - fprintf(stderr, "%s:%d ", fname, yylloc.first_line); - vfprintf(stderr, s, va); - fprintf(stderr, "\n"); - + srcpos_error(&yylloc, "%s", s); treesource_error = 1; - va_end(va); -} - -void yyerror (char const *s) -{ - yyerrorf("%s", s); } static unsigned long long eval_literal(const char *s, int base, int bits) |