Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/config Add debug print function.
details: https://anonhg.NetBSD.org/src/rev/b9a0a6f44ca4
branches: trunk
changeset: 332782:b9a0a6f44ca4
user: uebayasi <uebayasi%NetBSD.org@localhost>
date: Thu Oct 09 06:45:31 2014 +0000
description:
Add debug print function.
diffstat:
usr.bin/config/defs.h | 9 ++++++++-
usr.bin/config/main.c | 4 +++-
usr.bin/config/util.c | 27 ++++++++++++++++++++++++++-
3 files changed, 37 insertions(+), 3 deletions(-)
diffs (103 lines):
diff -r 896e88db997c -r b9a0a6f44ca4 usr.bin/config/defs.h
--- a/usr.bin/config/defs.h Thu Oct 09 04:58:42 2014 +0000
+++ b/usr.bin/config/defs.h Thu Oct 09 06:45:31 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: defs.h,v 1.46 2014/08/24 20:22:18 joerg Exp $ */
+/* $NetBSD: defs.h,v 1.47 2014/10/09 06:45:31 uebayasi Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -622,6 +622,13 @@
void prefix_push(const char *);
void prefix_pop(void);
char *sourcepath(const char *);
+#ifndef MAKE_BOOTSTRAP
+extern int dflag;
+#define CFGDBG(n, ...) \
+ do { if ((dflag) >= (n)) cfgdbg(__VA_ARGS__); } while (0)
+void cfgdbg(const char *, ...) /* debug info */
+ __printflike(1, 2);
+#endif
void cfgwarn(const char *, ...) /* immediate warns */
__printflike(1, 2);
void cfgxwarn(const char *, int, const char *, ...) /* delayed warns */
diff -r 896e88db997c -r b9a0a6f44ca4 usr.bin/config/main.c
--- a/usr.bin/config/main.c Thu Oct 09 04:58:42 2014 +0000
+++ b/usr.bin/config/main.c Thu Oct 09 06:45:31 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.54 2014/08/09 12:40:14 bad Exp $ */
+/* $NetBSD: main.c,v 1.55 2014/10/09 06:45:31 uebayasi Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -92,6 +92,7 @@
#ifndef MAKE_BOOTSTRAP
extern int yydebug;
+int dflag;
#endif
static struct dlhash *obsopttab;
@@ -166,6 +167,7 @@
#ifndef MAKE_BOOTSTRAP
case 'd':
yydebug = 1;
+ dflag++;
break;
#endif
diff -r 896e88db997c -r b9a0a6f44ca4 usr.bin/config/util.c
--- a/usr.bin/config/util.c Thu Oct 09 04:58:42 2014 +0000
+++ b/usr.bin/config/util.c Thu Oct 09 06:45:31 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: util.c,v 1.16 2013/11/01 21:39:13 christos Exp $ */
+/* $NetBSD: util.c,v 1.17 2014/10/09 06:45:31 uebayasi Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -57,6 +57,10 @@
static void cfgvxerror(const char *, int, const char *, va_list)
__printflike(3, 0);
+#ifndef MAKE_BOOTSTRAP
+static void cfgvxdbg(const char *, int, const char *, va_list)
+ __printflike(3, 0);
+#endif
static void cfgvxwarn(const char *, int, const char *, va_list)
__printflike(3, 0);
static void cfgvxmsg(const char *, int, const char *, const char *, va_list)
@@ -413,6 +417,19 @@
* Diagnostic messages
*/
+#ifndef MAKE_BOOTSTRAP
+void
+cfgdbg(const char *fmt, ...)
+{
+ va_list ap;
+ extern const char *yyfile;
+
+ va_start(ap, fmt);
+ cfgvxdbg(yyfile, currentline(), fmt, ap);
+ va_end(ap);
+}
+#endif
+
void
cfgwarn(const char *fmt, ...)
{
@@ -434,6 +451,14 @@
va_end(ap);
}
+#ifndef MAKE_BOOTSTRAP
+static void
+cfgvxdbg(const char *file, int line, const char *fmt, va_list ap)
+{
+ cfgvxmsg(file, line, "debug: ", fmt, ap);
+}
+#endif
+
static void
cfgvxwarn(const char *file, int line, const char *fmt, va_list ap)
{
Home |
Main Index |
Thread Index |
Old Index