afs: avoid empty-body warning

With Linux 6.10 commit:
    "kbuild: turn on -Wextra by default" (f5982cceb3)
there are additional compiler warnings that can turn
into build errors when --enable-checking is used.

    "error: suggest braces around empty body in an ‘if’
     statement [-Werror=empty-body]"

when there is an empty body, e.g.
    if (foo)
        ;

Most cases are due to the macros afs_PutCell and afs_PutServer which are
"empty" macros.

Update the afs_PutCell and afs_PutServer macros so they expand to
  do {} while(0)

Add a comment at the definitions for afs_PutCell and afs_PutServer to
document the reason for keeping them.

Add braces to conditionals that have an empty body.

There are no functional changes with this commit.

Reviewed-on: https://gerrit.openafs.org/15766
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
(cherry picked from commit d8b56f21994ce66d8daebb7d69e792f34c1a19ed)

Change-Id: I0617aeba36b638ae36678043216e2b4c145921b7
Reviewed-on: https://gerrit.openafs.org/15799
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
This commit is contained in:
Cheyenne Wills 2024-06-12 14:24:01 -06:00 committed by Benjamin Kaduk
parent f08f7e821a
commit e24033ddab
2 changed files with 7 additions and 3 deletions

View File

@ -348,7 +348,8 @@ struct cell_alias {
char *cell; char *cell;
}; };
#define afs_PutCell(cellp, locktype) /* In case someday a counterpart for afs_GetCell is needed */
#define afs_PutCell(cellp, locktype) do {} while(0)
/* the unixuser flag bit definitions */ /* the unixuser flag bit definitions */
#define UHasTokens 1 /* are the st and ct fields valid (ever set)? */ #define UHasTokens 1 /* are the st and ct fields valid (ever set)? */
@ -536,7 +537,8 @@ struct server {
afs_int32 capabilities; afs_int32 capabilities;
}; };
#define afs_PutServer(servp, locktype) /* In case someday a counterpart for afs_GetServer is needed */
#define afs_PutServer(servp, locktype) do {} while(0)
/* structs for some pioctls - these are (or should be) /* structs for some pioctls - these are (or should be)
* also in venus.h * also in venus.h

View File

@ -139,7 +139,9 @@ afs_DequeueCallback(struct vcache *avc)
debugvc = avc; debugvc = avc;
if (avc->callsort.prev) { if (avc->callsort.prev) {
QRemove(&(avc->callsort)); QRemove(&(avc->callsort));
} else; /* must have got dequeued in a race */ } else {
/* must have got dequeued in a race */
}
return; return;
} /* afs_DequeueCallback */ } /* afs_DequeueCallback */