From: Benjamin Kaduk Date: Fri, 5 Jan 2018 04:00:15 +0000 (-0600) Subject: rx: remove trailing semicolons from FBSD mutex operations X-Git-Tag: upstream/1.8.0_pre5^2~7 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=5bb7684f07b5f346b68230c2f38edad4c46dc648;p=packages%2Fo%2Fopenafs.git rx: remove trailing semicolons from FBSD mutex operations Since the first introduction of FreeBSD support, the macros (MUTEX_ENTER, etc.) for kernel mutex operations have included trailing semicolons, unique among all the platforms. This did not cause problems until the recent work on rx event handlers, which put a MUTEX_ENTER() in the body of an 'if' clause with no brackets, and attempted to follow it with an 'else' clause. This results in the following (rather obtuse) compiler error: /root/openafs/src/rx/rx.c:3666:5: error: expected expression else ^ Which is more visible in the preprocessed source, as if (condition) expression;; else other_expression; is clearly invalid C. To fix the FreeBSD kernel module build, remove the unneeded semicolons. Reviewed-on: https://gerrit.openafs.org/12853 Tested-by: BuildBot Reviewed-by: Benjamin Kaduk (cherry picked from commit 0760feb7992e1e39f716c5f583fe7f6e85584262) Change-Id: I503a5967a167e9be92721af8dc82d191f3bf18ba Reviewed-on: https://gerrit.openafs.org/12899 Tested-by: BuildBot Reviewed-by: Mark Vitale Reviewed-by: Benjamin Kaduk --- diff --git a/src/rx/FBSD/rx_kmutex.h b/src/rx/FBSD/rx_kmutex.h index a694a52b1..660494c86 100644 --- a/src/rx/FBSD/rx_kmutex.h +++ b/src/rx/FBSD/rx_kmutex.h @@ -38,23 +38,23 @@ typedef struct { #define MUTEX_INIT(a,b,c,d) \ do { \ (a)->owner = 0; \ - } while(0); + } while(0) #define MUTEX_DESTROY(a) \ do { \ (a)->owner = (struct proc *)-1; \ - } while(0); + } while(0) #define MUTEX_ENTER(a) \ do { \ osi_Assert((a)->owner == 0); \ (a)->owner = curproc; \ - } while(0); + } while(0) #define MUTEX_TRYENTER(a) \ ( osi_Assert((a)->owner == 0), (a)->owner = curproc, 1) #define MUTEX_EXIT(a) \ do { \ osi_Assert((a)->owner == curproc); \ (a)->owner = 0; \ - } while(0); + } while(0) #define MUTEX_ASSERT(a) osi_Assert(((afs_kmutex_t *)(a))->owner == curproc) @@ -64,7 +64,7 @@ typedef struct mtx afs_kmutex_t; #if defined(AFS_FBSD80_ENV) && defined(WITNESS) #define WITCLEAR_MTX(a) \ - do { memset((a), 0, sizeof(struct mtx)); } while(0); + do { memset((a), 0, sizeof(struct mtx)); } while(0) #else #define WITCLEAR_MTX(a) {} #endif @@ -73,17 +73,17 @@ typedef struct mtx afs_kmutex_t; do { \ WITCLEAR_MTX(a); \ mtx_init((a), (b), 0 /* type defaults to name */, MTX_DEF | MTX_DUPOK); \ - } while(0); + } while(0) #define MUTEX_DESTROY(a) \ do { \ mtx_destroy((a)); \ - } while(0); + } while(0) #define MUTEX_ENTER(a) \ do { \ mtx_lock((a)); \ - } while(0); + } while(0) #define MUTEX_TRYENTER(a) \ ( mtx_trylock((a)) ) @@ -91,7 +91,7 @@ typedef struct mtx afs_kmutex_t; #define MUTEX_EXIT(a) \ do { \ mtx_unlock((a)); \ - } while(0); + } while(0) #define MUTEX_ASSERT(a) \ osi_Assert(mtx_owned((a))) @@ -108,17 +108,17 @@ typedef struct { do { \ lockinit(&(a)->lock,PSOCK, "afs rx mutex", 0, 0); \ (a)->owner = 0; \ - } while(0); + } while(0) #define MUTEX_DESTROY(a) \ do { \ (a)->owner = (struct proc *)-1; \ - } while(0); + } while(0) #define MUTEX_ENTER(a) \ do { \ lockmgr(&(a)->lock, LK_EXCLUSIVE, 0, curthread); \ osi_Assert((a)->owner == 0); \ (a)->owner = curthread; \ - } while(0); + } while(0) #define MUTEX_TRYENTER(a) \ ( lockmgr(&(a)->lock, LK_EXCLUSIVE|LK_NOWAIT, 0, curthread) ? 0 : ((a)->owner = curthread, 1) ) #define xMUTEX_TRYENTER(a) \ @@ -128,7 +128,7 @@ typedef struct { osi_Assert((a)->owner == curthread); \ (a)->owner = 0; \ lockmgr(&(a)->lock, LK_RELEASE, 0, curthread); \ - } while(0); + } while(0) #define MUTEX_ASSERT(a) osi_Assert(((afs_kmutex_t *)(a))->owner == curthread) #endif