* [PATCH 1/3] Add yyerrorf() for formatted error messages.
@ 2008-01-03 23:43 Scott Wood
2008-01-03 23:45 ` Scott Wood
2008-01-04 4:07 ` David Gibson
0 siblings, 2 replies; 5+ messages in thread
From: Scott Wood @ 2008-01-03 23:43 UTC (permalink / raw)
To: jdl; +Cc: linuxppc-dev
Signed-off-by: Scott Wood <scottwood@freescale.com>
---
dtc-parser.y | 16 +++++++++++++---
srcpos.h | 1 +
treesource.c | 1 -
3 files changed, 14 insertions(+), 4 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)
diff --git a/srcpos.h b/srcpos.h
index ce7ab5b..e59c788 100644
--- a/srcpos.h
+++ b/srcpos.h
@@ -63,6 +63,7 @@ typedef struct YYLTYPE {
extern void yyerror(char const *);
+extern void yyerrorf(char const *, ...) __attribute__((format(printf, 1, 2)));
extern int srcpos_filenum;
diff --git a/treesource.c b/treesource.c
index a6a7767..e7d580f 100644
--- a/treesource.c
+++ b/treesource.c
@@ -23,7 +23,6 @@
extern FILE *yyin;
extern int yyparse(void);
-extern void yyerror(char const *);
struct boot_info *the_boot_info;
--
1.5.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/3] Add yyerrorf() for formatted error messages.
2008-01-03 23:43 [PATCH 1/3] Add yyerrorf() for formatted error messages Scott Wood
@ 2008-01-03 23:45 ` Scott Wood
2008-01-04 14:30 ` Jon Loeliger
2008-01-04 4:07 ` David Gibson
1 sibling, 1 reply; 5+ messages in thread
From: Scott Wood @ 2008-01-03 23:45 UTC (permalink / raw)
To: jdl; +Cc: linuxppc-dev
Scott Wood wrote:
> Signed-off-by: Scott Wood <scottwood@freescale.com>
> ---
> dtc-parser.y | 16 +++++++++++++---
> srcpos.h | 1 +
> treesource.c | 1 -
> 3 files changed, 14 insertions(+), 4 deletions(-)
I forgot to tag them as such, but these are of course dtc patches and
not Linux patches.
-Scott
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/3] Add yyerrorf() for formatted error messages.
2008-01-03 23:43 [PATCH 1/3] Add yyerrorf() for formatted error messages Scott Wood
2008-01-03 23:45 ` Scott Wood
@ 2008-01-04 4:07 ` David Gibson
1 sibling, 0 replies; 5+ messages in thread
From: David Gibson @ 2008-01-04 4:07 UTC (permalink / raw)
To: Scott Wood; +Cc: linuxppc-dev, jdl
On Thu, Jan 03, 2008 at 05:43:29PM -0600, Scott Wood wrote:
> Signed-off-by: Scott Wood <scottwood@freescale.com>
I don't really like adding any yy*() functions that aren't actually
part of the fixed lex/yacc interface. But, despite that, let's merge
this, and parth 2/3 because I think we should get in sane include
searching for 1.1. I'll look at polishing the message printing stuff
later.
Acked-by: David Gibson <david@ribson.dropbear.id.au>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/3] Add yyerrorf() for formatted error messages.
2008-01-03 23:45 ` Scott Wood
@ 2008-01-04 14:30 ` Jon Loeliger
2008-01-04 16:55 ` Scott Wood
0 siblings, 1 reply; 5+ messages in thread
From: Jon Loeliger @ 2008-01-04 14:30 UTC (permalink / raw)
To: Scott Wood; +Cc: linuxppc-dev
So, like, the other day Scott Wood mumbled:
>
> I forgot to tag them as such, but these are of course dtc patches and
> not Linux patches.
All three applied (to DTC :-)).
Will you follow up with a patch for /bininc/ or /bin-include/
as well now? (I'm fine with either, and I forget where David's
preference there landed.)
Thanks,
jdl
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/3] Add yyerrorf() for formatted error messages.
2008-01-04 14:30 ` Jon Loeliger
@ 2008-01-04 16:55 ` Scott Wood
0 siblings, 0 replies; 5+ messages in thread
From: Scott Wood @ 2008-01-04 16:55 UTC (permalink / raw)
To: Jon Loeliger; +Cc: linuxppc-dev
On Fri, Jan 04, 2008 at 08:30:12AM -0600, Jon Loeliger wrote:
> All three applied (to DTC :-)).
>
> Will you follow up with a patch for /bininc/ or /bin-include/
> as well now? (I'm fine with either, and I forget where David's
> preference there landed.)
Yes, probably sometime today.
-Scott
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-01-04 16:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-03 23:43 [PATCH 1/3] Add yyerrorf() for formatted error messages Scott Wood
2008-01-03 23:45 ` Scott Wood
2008-01-04 14:30 ` Jon Loeliger
2008-01-04 16:55 ` Scott Wood
2008-01-04 4:07 ` David Gibson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).