rx: remove trailing semicolons from FBSD mutex operations 53/12853/2
authorBenjamin Kaduk <kaduk@mit.edu>
Fri, 5 Jan 2018 04:00:15 +0000 (22:00 -0600)
committerBenjamin Kaduk <kaduk@mit.edu>
Tue, 9 Jan 2018 02:46:25 +0000 (21:46 -0500)
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.

Change-Id: I191009ad412852dcc03cd71a0982fe41a953301d
Reviewed-on: https://gerrit.openafs.org/12853
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

src/rx/FBSD/rx_kmutex.h

index a694a52..660494c 100644 (file)
@@ -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