Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/hpcarm/hpcarm Wrap multi-line macros with ``do { } ...



details:   https://anonhg.NetBSD.org/src/rev/db66e2f285ab
branches:  trunk
changeset: 989086:db66e2f285ab
user:      rin <rin%NetBSD.org@localhost>
date:      Mon Oct 11 14:33:31 2021 +0000

description:
Wrap multi-line macros with ``do { } while(0)''.

diffstat:

 sys/arch/hpcarm/hpcarm/sa11x0_hpc_machdep.c |  20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diffs (41 lines):

diff -r 19fdd0eacbbc -r db66e2f285ab sys/arch/hpcarm/hpcarm/sa11x0_hpc_machdep.c
--- a/sys/arch/hpcarm/hpcarm/sa11x0_hpc_machdep.c       Mon Oct 11 14:30:30 2021 +0000
+++ b/sys/arch/hpcarm/hpcarm/sa11x0_hpc_machdep.c       Mon Oct 11 14:33:31 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sa11x0_hpc_machdep.c,v 1.19 2021/10/11 14:30:30 rin Exp $      */
+/*     $NetBSD: sa11x0_hpc_machdep.c,v 1.20 2021/10/11 14:33:31 rin Exp $      */
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sa11x0_hpc_machdep.c,v 1.19 2021/10/11 14:30:30 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sa11x0_hpc_machdep.c,v 1.20 2021/10/11 14:33:31 rin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_dram_pages.h"
@@ -277,12 +277,16 @@
 #endif
 
        /* Define a macro to simplify memory allocation */
-#define        valloc_pages(var, np)                   \
-       alloc_pages((var).pv_pa, (np));         \
-       (var).pv_va = KERNEL_BASE + (var).pv_pa - physical_start;
-#define        alloc_pages(var, np)                    \
-       (var) = freemempos;                     \
-       freemempos += (np) * PAGE_SIZE;
+#define        valloc_pages(var, np)                                           \
+    do {                                                               \
+       alloc_pages((var).pv_pa, (np));                                 \
+       (var).pv_va = KERNEL_BASE + (var).pv_pa - physical_start;       \
+    } while (0)
+#define        alloc_pages(var, np)                                            \
+    do {                                                               \
+       (var) = freemempos;                                             \
+       freemempos += (np) * PAGE_SIZE;                                 \
+    } while (0)
 
        valloc_pages(kernel_l1pt, L1_TABLE_SIZE / PAGE_SIZE);
        for (loop = 0; loop < NUM_KERNEL_PTS; ++loop) {



Home | Main Index | Thread Index | Old Index