Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Consistently define WARN in a way that passes forma...
details: https://anonhg.NetBSD.org/src/rev/7e54f6060484
branches: trunk
changeset: 331271:7e54f6060484
user: joerg <joerg%NetBSD.org@localhost>
date: Wed Aug 06 21:57:48 2014 +0000
description:
Consistently define WARN in a way that passes format string checks, i.e.
always uses the same number of arguments as given in the format string.
diffstat:
sys/arch/acorn26/include/loadfile_machdep.h | 13 +++++++++----
sys/arch/acorn32/include/loadfile_machdep.h | 13 +++++++++----
sys/arch/alpha/include/loadfile_machdep.h | 13 +++++++++----
sys/arch/amiga/include/loadfile_machdep.h | 13 +++++++++----
sys/arch/arc/include/loadfile_machdep.h | 13 +++++++++----
sys/arch/bebox/include/loadfile_machdep.h | 13 +++++++++----
sys/arch/cobalt/include/loadfile_machdep.h | 13 +++++++++----
sys/arch/emips/include/loadfile_machdep.h | 13 +++++++++----
sys/arch/epoc32/include/loadfile_machdep.h | 13 +++++++++----
sys/arch/evbarm/include/loadfile_machdep.h | 11 ++++++++---
sys/arch/evbcf/include/loadfile_machdep.h | 13 +++++++++----
sys/arch/evbppc/include/loadfile_machdep.h | 13 +++++++++----
sys/arch/ews4800mips/include/loadfile_machdep.h | 13 +++++++++----
sys/arch/hp300/include/loadfile_machdep.h | 13 +++++++++----
sys/arch/hpcmips/include/loadfile_machdep.h | 13 +++++++++----
sys/arch/hppa/include/loadfile_machdep.h | 13 +++++++++----
sys/arch/ia64/include/loadfile_machdep.h | 13 +++++++++----
sys/arch/landisk/include/loadfile_machdep.h | 13 +++++++++----
sys/arch/luna68k/include/loadfile_machdep.h | 13 +++++++++----
sys/arch/macppc/include/loadfile_machdep.h | 13 +++++++++----
sys/arch/mipsco/include/loadfile_machdep.h | 13 +++++++++----
sys/arch/mmeye/include/loadfile_machdep.h | 13 +++++++++----
sys/arch/mvme68k/include/loadfile_machdep.h | 13 +++++++++----
sys/arch/mvmeppc/include/loadfile_machdep.h | 13 +++++++++----
sys/arch/news68k/include/loadfile_machdep.h | 13 +++++++++----
sys/arch/newsmips/include/loadfile_machdep.h | 13 +++++++++----
sys/arch/next68k/include/loadfile_machdep.h | 13 +++++++++----
sys/arch/ofppc/include/loadfile_machdep.h | 13 +++++++++----
sys/arch/pmax/include/loadfile_machdep.h | 13 +++++++++----
sys/arch/prep/include/loadfile_machdep.h | 13 +++++++++----
sys/arch/rs6000/include/loadfile_machdep.h | 13 +++++++++----
sys/arch/sandpoint/include/loadfile_machdep.h | 13 +++++++++----
sys/arch/sbmips/include/loadfile_machdep.h | 13 +++++++++----
sys/arch/sgimips/include/loadfile_machdep.h | 13 +++++++++----
sys/arch/shark/include/loadfile_machdep.h | 13 +++++++++----
sys/arch/sparc/include/loadfile_machdep.h | 13 +++++++++----
sys/arch/sparc64/include/loadfile_machdep.h | 13 +++++++++----
sys/arch/sun68k/include/loadfile_machdep.h | 13 +++++++++----
sys/arch/vax/include/loadfile_machdep.h | 13 +++++++++----
sys/arch/x68k/include/loadfile_machdep.h | 13 +++++++++----
sys/arch/x86/include/loadfile_machdep.h | 13 +++++++++----
sys/arch/zaurus/include/loadfile_machdep.h | 13 +++++++++----
42 files changed, 377 insertions(+), 167 deletions(-)
diffs (truncated from 1128 to 300 lines):
diff -r eaf56db9faa3 -r 7e54f6060484 sys/arch/acorn26/include/loadfile_machdep.h
--- a/sys/arch/acorn26/include/loadfile_machdep.h Wed Aug 06 19:41:41 2014 +0000
+++ b/sys/arch/acorn26/include/loadfile_machdep.h Wed Aug 06 21:57:48 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: loadfile_machdep.h,v 1.4 2009/01/14 23:14:48 bjh21 Exp $ */
+/* $NetBSD: loadfile_machdep.h,v 1.5 2014/08/06 21:57:48 joerg Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -44,9 +44,14 @@
#define READ(f, b, c) boot26_read((f), (void *)LOADADDR(b), (c))
#define BCOPY(s, d, c) boot26_memcpy((void *)LOADADDR(d), (s), (c))
#define BZERO(d, c) boot26_memset((void *)LOADADDR(d), 0, (c))
-#define WARN(a) (void)(printf a, \
- printf((errno ? ": %s\n" : "\n"), \
- strerror(errno)))
+#define WARN(a) do { \
+ (void)printf a; \
+ if (errno) \
+ (void)printf(": %s\n", \
+ strerror(errno)); \
+ else \
+ (void)printf("\n"); \
+ } while(/* CONSTCOND */0)
#define PROGRESS(a) (void) printf a
#define ALLOC(a) alloc(a)
#define DEALLOC(a, b) dealloc(a, b)
diff -r eaf56db9faa3 -r 7e54f6060484 sys/arch/acorn32/include/loadfile_machdep.h
--- a/sys/arch/acorn32/include/loadfile_machdep.h Wed Aug 06 19:41:41 2014 +0000
+++ b/sys/arch/acorn32/include/loadfile_machdep.h Wed Aug 06 21:57:48 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: loadfile_machdep.h,v 1.5 2009/03/14 14:45:51 dsl Exp $ */
+/* $NetBSD: loadfile_machdep.h,v 1.6 2014/08/06 21:57:48 joerg Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -44,9 +44,14 @@
#define READ(f, b, c) boot32_read((f), (void *)LOADADDR(b), (c))
#define BCOPY(s, d, c) boot32_memcpy((void *)LOADADDR(d), (s), (c))
#define BZERO(d, c) boot32_memset((void *)LOADADDR(d), 0, (c))
-#define WARN(a) (void)(printf a, \
- printf((errno ? ": %s\n" : "\n"), \
- strerror(errno)))
+#define WARN(a) do { \
+ (void)printf a; \
+ if (errno) \
+ (void)printf(": %s\n", \
+ strerror(errno)); \
+ else \
+ (void)printf("\n"); \
+ } while(/* CONSTCOND */0)
#define PROGRESS(a) (void) printf a
#define ALLOC(a) alloc(a)
#define DEALLOC(a, b) dealloc(a, b)
diff -r eaf56db9faa3 -r 7e54f6060484 sys/arch/alpha/include/loadfile_machdep.h
--- a/sys/arch/alpha/include/loadfile_machdep.h Wed Aug 06 19:41:41 2014 +0000
+++ b/sys/arch/alpha/include/loadfile_machdep.h Wed Aug 06 21:57:48 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: loadfile_machdep.h,v 1.5 2008/04/28 20:23:11 martin Exp $ */
+/* $NetBSD: loadfile_machdep.h,v 1.6 2014/08/06 21:57:48 joerg Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -39,9 +39,14 @@
#define READ(f, b, c) pread((f), (void *)LOADADDR(b), (c))
#define BCOPY(s, d, c) vpbcopy((s), (void *)LOADADDR(d), (c))
#define BZERO(d, c) pbzero((void *)LOADADDR(d), (c))
-#define WARN(a) (void)(printf a, \
- printf((errno ? ": %s\n" : "\n"), \
- strerror(errno)))
+#define WARN(a) do { \
+ (void)printf a; \
+ if (errno) \
+ (void)printf(": %s\n", \
+ strerror(errno)); \
+ else \
+ (void)printf("\n"); \
+ } while(/* CONSTCOND */0)
#define PROGRESS(a) (void) printf a
#define ALLOC(a) alloc(a)
#define DEALLOC(a, b) dealloc(a, b)
diff -r eaf56db9faa3 -r 7e54f6060484 sys/arch/amiga/include/loadfile_machdep.h
--- a/sys/arch/amiga/include/loadfile_machdep.h Wed Aug 06 19:41:41 2014 +0000
+++ b/sys/arch/amiga/include/loadfile_machdep.h Wed Aug 06 21:57:48 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: loadfile_machdep.h,v 1.5 2009/03/14 14:45:54 dsl Exp $ */
+/* $NetBSD: loadfile_machdep.h,v 1.6 2014/08/06 21:57:49 joerg Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -45,9 +45,14 @@
#define READ(f, b, c) pread((f), (void *)LOADADDR(b), (c))
#define BCOPY(s, d, c) vpbcopy((s), (void *)LOADADDR(d), (c))
#define BZERO(d, c) pbzero((void *)LOADADDR(d), (c))
-#define WARN(a) (void)(printf a, \
- printf((errno ? ": %s\n" : "\n"), \
- strerror(errno)))
+#define WARN(a) do { \
+ (void)printf a; \
+ if (errno) \
+ (void)printf(": %s\n", \
+ strerror(errno)); \
+ else \
+ (void)printf("\n"); \
+ } while(/* CONSTCOND */0)
#define PROGRESS(a) (void) printf a
#define ALLOC(a) alloc(a)
#define DEALLOC(a, b) dealloc(a, b)
diff -r eaf56db9faa3 -r 7e54f6060484 sys/arch/arc/include/loadfile_machdep.h
--- a/sys/arch/arc/include/loadfile_machdep.h Wed Aug 06 19:41:41 2014 +0000
+++ b/sys/arch/arc/include/loadfile_machdep.h Wed Aug 06 21:57:48 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: loadfile_machdep.h,v 1.4 2008/04/28 20:23:13 martin Exp $ */
+/* $NetBSD: loadfile_machdep.h,v 1.5 2014/08/06 21:57:49 joerg Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -43,9 +43,14 @@
#define READ(f, b, c) read((f), (void *)LOADADDR(b), (c))
#define BCOPY(s, d, c) memcpy((void *)LOADADDR(d), (void *)(s), (c))
#define BZERO(d, c) memset((void *)LOADADDR(d), 0, (c))
-#define WARN(a) (void)(printf a, \
- printf((errno ? ": %s\n" : "\n"), \
- strerror(errno)))
+#define WARN(a) do { \
+ (void)printf a; \
+ if (errno) \
+ (void)printf(": %s\n", \
+ strerror(errno)); \
+ else \
+ (void)printf("\n"); \
+ } while(/* CONSTCOND */0)
#define PROGRESS(a) (void) printf a
#define ALLOC(a) alloc(a)
#define DEALLOC(a, b) dealloc(a, b)
diff -r eaf56db9faa3 -r 7e54f6060484 sys/arch/bebox/include/loadfile_machdep.h
--- a/sys/arch/bebox/include/loadfile_machdep.h Wed Aug 06 19:41:41 2014 +0000
+++ b/sys/arch/bebox/include/loadfile_machdep.h Wed Aug 06 21:57:48 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: loadfile_machdep.h,v 1.4 2008/04/28 20:23:15 martin Exp $ */
+/* $NetBSD: loadfile_machdep.h,v 1.5 2014/08/06 21:57:49 joerg Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -39,9 +39,14 @@
#define READ(f, b, c) read((f), (void *)LOADADDR(b), (c))
#define BCOPY(s, d, c) memcpy((void *)LOADADDR(d), (void *)(s), (c))
#define BZERO(d, c) memset((void *)LOADADDR(d), 0, (c))
-#define WARN(a) (void)(printf a, \
- printf((errno ? ": %s\n" : "\n"), \
- strerror(errno)))
+#define WARN(a) do { \
+ (void)printf a; \
+ if (errno) \
+ (void)printf(": %s\n", \
+ strerror(errno)); \
+ else \
+ (void)printf("\n"); \
+ } while(/* CONSTCOND */0)
#define PROGRESS(a) (void) printf a
#define ALLOC(a) alloc(a)
#define DEALLOC(a, b) dealloc(a, b)
diff -r eaf56db9faa3 -r 7e54f6060484 sys/arch/cobalt/include/loadfile_machdep.h
--- a/sys/arch/cobalt/include/loadfile_machdep.h Wed Aug 06 19:41:41 2014 +0000
+++ b/sys/arch/cobalt/include/loadfile_machdep.h Wed Aug 06 21:57:48 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: loadfile_machdep.h,v 1.3 2008/04/28 20:23:16 martin Exp $ */
+/* $NetBSD: loadfile_machdep.h,v 1.4 2014/08/06 21:57:49 joerg Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -43,9 +43,14 @@
#define READ(f, b, c) read((f), (void *)LOADADDR(b), (c))
#define BCOPY(s, d, c) memcpy((void *)LOADADDR(d), (void *)(s), (c))
#define BZERO(d, c) memset((void *)LOADADDR(d), 0, (c))
-#define WARN(a) (void)(printf a, \
- printf((errno ? ": %s\n" : "\n"), \
- strerror(errno)))
+#define WARN(a) do { \
+ (void)printf a; \
+ if (errno) \
+ (void)printf(": %s\n", \
+ strerror(errno)); \
+ else \
+ (void)printf("\n"); \
+ } while(/* CONSTCOND */0)
#define PROGRESS(a) (void) printf a
#define ALLOC(a) alloc(a)
#define DEALLOC(a, b) dealloc(a, b)
diff -r eaf56db9faa3 -r 7e54f6060484 sys/arch/emips/include/loadfile_machdep.h
--- a/sys/arch/emips/include/loadfile_machdep.h Wed Aug 06 19:41:41 2014 +0000
+++ b/sys/arch/emips/include/loadfile_machdep.h Wed Aug 06 21:57:48 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: loadfile_machdep.h,v 1.1 2011/01/26 01:18:52 pooka Exp $ */
+/* $NetBSD: loadfile_machdep.h,v 1.2 2014/08/06 21:57:49 joerg Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -50,9 +50,14 @@
#define READ(f, b, c) read((f), (void *)LOADADDR(b), (c))
#define BCOPY(s, d, c) memcpy((void *)LOADADDR(d), (void *)(s), (c))
#define BZERO(d, c) memset((void *)LOADADDR(d), 0, (c))
-#define WARN(a) (void)(printf a, \
- printf((errno ? ": %s\n" : "\n"), \
- strerror(errno)))
+#define WARN(a) do { \
+ (void)printf a; \
+ if (errno) \
+ (void)printf(": %s\n", \
+ strerror(errno)); \
+ else \
+ (void)printf("\n"); \
+ } while(/* CONSTCOND */0)
#define PROGRESS(a) (void) printf a
#define ALLOC(a) alloc(a)
#define DEALLOC(a, b) dealloc(a, b)
diff -r eaf56db9faa3 -r 7e54f6060484 sys/arch/epoc32/include/loadfile_machdep.h
--- a/sys/arch/epoc32/include/loadfile_machdep.h Wed Aug 06 19:41:41 2014 +0000
+++ b/sys/arch/epoc32/include/loadfile_machdep.h Wed Aug 06 21:57:48 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: loadfile_machdep.h,v 1.1 2013/04/28 12:11:26 kiyohara Exp $ */
+/* $NetBSD: loadfile_machdep.h,v 1.2 2014/08/06 21:57:49 joerg Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -39,9 +39,14 @@
#define READ(f, b, c) read((f), (void *)LOADADDR(b), (c))
#define BCOPY(s, d, c) memcpy((void *)LOADADDR(d), (void *)(s), (c))
#define BZERO(d, c) memset((void *)LOADADDR(d), 0, (c))
-#define WARN(a) (void)(printf a, \
- printf((errno ? ": %s\n" : "\n"), \
- strerror(errno)))
+#define WARN(a) do { \
+ (void)printf a; \
+ if (errno) \
+ (void)printf(": %s\n", \
+ strerror(errno)); \
+ else \
+ (void)printf("\n"); \
+ } while(/* CONSTCOND */0)
#define PROGRESS(a) (void) printf a
#ifdef _STANDALONE
diff -r eaf56db9faa3 -r 7e54f6060484 sys/arch/evbarm/include/loadfile_machdep.h
--- a/sys/arch/evbarm/include/loadfile_machdep.h Wed Aug 06 19:41:41 2014 +0000
+++ b/sys/arch/evbarm/include/loadfile_machdep.h Wed Aug 06 21:57:48 2014 +0000
@@ -9,9 +9,14 @@
#define READ(f, b, c) read((f), (void*)LOADADDR(b), (c))
#define BCOPY(s, d, c) memcpy((void*)LOADADDR(d), (void*)(s), (c))
#define BZERO(d, c) memset((void*)LOADADDR(d), 0, (c))
-#define WARN(a) (void)(printf a, \
- printf((errno ? ": %s\n" : "\n"), \
- strerror(errno)))
+#define WARN(a) do { \
+ (void)printf a; \
+ if (errno) \
+ (void)printf(": %s\n", \
+ strerror(errno)); \
+ else \
+ (void)printf("\n"); \
+ } while(/* CONSTCOND */0)
#define PROGRESS(a) (void)printf a
#define ALLOC(a) alloc(a)
#define DEALLOC(a, b) dealloc(a, b)
diff -r eaf56db9faa3 -r 7e54f6060484 sys/arch/evbcf/include/loadfile_machdep.h
--- a/sys/arch/evbcf/include/loadfile_machdep.h Wed Aug 06 19:41:41 2014 +0000
+++ b/sys/arch/evbcf/include/loadfile_machdep.h Wed Aug 06 21:57:48 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: loadfile_machdep.h,v 1.2 2014/03/18 18:20:41 riastradh Exp $ */
+/* $NetBSD: loadfile_machdep.h,v 1.3 2014/08/06 21:57:49 joerg Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -45,9 +45,14 @@
#ifdef _STANDALONE
-#define WARN(a) (void)(printf a, \
- printf((errno ? ": %s\n" : "\n"), \
- strerror(errno)))
+#define WARN(a) do { \
+ (void)printf a; \
+ if (errno) \
+ (void)printf(": %s\n", \
+ strerror(errno)); \
+ else \
+ (void)printf("\n"); \
+ } while(/* CONSTCOND */0)
#define PROGRESS(a) (void) printf a
#define ALLOC(a) alloc(a)
#define DEALLOC(a, b) dealloc(a, b)
diff -r eaf56db9faa3 -r 7e54f6060484 sys/arch/evbppc/include/loadfile_machdep.h
--- a/sys/arch/evbppc/include/loadfile_machdep.h Wed Aug 06 19:41:41 2014 +0000
+++ b/sys/arch/evbppc/include/loadfile_machdep.h Wed Aug 06 21:57:48 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: loadfile_machdep.h,v 1.5 2008/04/28 20:23:17 martin Exp $ */
+/* $NetBSD: loadfile_machdep.h,v 1.6 2014/08/06 21:57:49 joerg Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
Home |
Main Index |
Thread Index |
Old Index