[Crosstoolchain-logs] [device-tree-compiler] 111/198: Make srcpos_{v, }error() more widely useful
Hector Oron
zumbi at moszumanska.debian.org
Thu Dec 8 17:06:59 UTC 2016
This is an automated email from the git hooks/post-receive script.
zumbi pushed a commit to branch upstream/1.4.x
in repository device-tree-compiler.
commit 0e2d3992258ff4129a8c0f79b660e92994411684
Author: David Gibson <david at gibson.dropbear.id.au>
Date: Wed Jan 1 23:27:31 2014 +1100
Make srcpos_{v,}error() more widely useful
Allow them to take a prefix argument giving the general type of error,
which will be useful in future.
Signed-off-by: David Gibson <david at gibson.dropbear.id.au>
---
dtc-parser.y | 2 +-
srcpos.c | 12 ++++++------
srcpos.h | 10 ++++++----
3 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/dtc-parser.y b/dtc-parser.y
index 4864631..2bcef1b 100644
--- a/dtc-parser.y
+++ b/dtc-parser.y
@@ -475,7 +475,7 @@ void print_error(char const *fmt, ...)
va_list va;
va_start(va, fmt);
- srcpos_verror(&yylloc, fmt, va);
+ srcpos_verror(&yylloc, "Error", fmt, va);
va_end(va);
treesource_error = true;
diff --git a/srcpos.c b/srcpos.c
index 6705fed..3999675 100644
--- a/srcpos.c
+++ b/srcpos.c
@@ -290,27 +290,27 @@ srcpos_string(struct srcpos *pos)
return pos_str;
}
-void
-srcpos_verror(struct srcpos *pos, const char *fmt, va_list va)
+void srcpos_verror(struct srcpos *pos, const char *prefix,
+ const char *fmt, va_list va)
{
char *srcstr;
srcstr = srcpos_string(pos);
- fprintf(stderr, "Error: %s ", srcstr);
+ fprintf(stderr, "%s: %s ", prefix, srcstr);
vfprintf(stderr, fmt, va);
fprintf(stderr, "\n");
free(srcstr);
}
-void
-srcpos_error(struct srcpos *pos, const char *fmt, ...)
+void srcpos_error(struct srcpos *pos, const char *prefix,
+ const char *fmt, ...)
{
va_list va;
va_start(va, fmt);
- srcpos_verror(pos, fmt, va);
+ srcpos_verror(pos, prefix, fmt, va);
va_end(va);
}
diff --git a/srcpos.h b/srcpos.h
index 46ea08a..f81827b 100644
--- a/srcpos.h
+++ b/srcpos.h
@@ -107,10 +107,12 @@ extern struct srcpos *srcpos_copy(struct srcpos *pos);
extern char *srcpos_string(struct srcpos *pos);
extern void srcpos_dump(struct srcpos *pos);
-extern void srcpos_verror(struct srcpos *pos, const char *, va_list va)
- __attribute__((format(printf, 2, 0)));
-extern void srcpos_error(struct srcpos *pos, const char *, ...)
- __attribute__((format(printf, 2, 3)));
+extern void srcpos_verror(struct srcpos *pos, const char *prefix,
+ const char *fmt, va_list va)
+ __attribute__((format(printf, 3, 0)));
+extern void srcpos_error(struct srcpos *pos, const char *prefix,
+ const char *fmt, ...)
+ __attribute__((format(printf, 3, 4)));
extern void srcpos_set_line(char *f, int l);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/crosstoolchain/device-tree-compiler.git
More information about the Crosstoolchain-logs
mailing list