OpenAFS Master Repository branch, openafs-stable-1_8_x, updated. openafs-stable-1_8_13_2-54-g4d224c7
Gerrit Code Review
gerrit@openafs.org
Thu, 29 May 2025 12:32:37 -0400
The following commit has been merged in the openafs-stable-1_8_x branch:
commit 4d224c7df7b5e0bf0e17400ad6ef6a05695a60dd
Author: Cheyenne Wills <cwills@sinenomine.net>
Date: Wed Feb 26 08:03:18 2025 -0700
Convert HAVE_STRUCT_LABEL_SUPPORT to AFS_STRUCT_INIT
The OpenAFS coding style allows the use of designated initializers for
structs, however not all supported platforms have compilers that support
it.
The preprocessor define HAVE_STRUCT_LABEL_SUPPORT has been available for
use so structure initialization can be set up to support compilers that
do have designated initializers support.
The typical use is:
struct foo x = {
#ifndef HAVE_STRUCT_LABEL_SUPPORT
val1,
val2,
...
#else
.mem1 = val1,
.mem2 = val2,
...
#endif
};
This results in extra lines of code where errors can easily be
introduced.
Create a macro, AFS_STRUCT_INIT, that uses designated initializers when
available, so the above example would be:
struct foo x = {
AFS_STRUCT_INIT(.mem1, val1),
AFS_STRUCT_INIT(.mem2, val2),
...
};
Convert the initialization of structures that are using the
HAVE_STRUCT_LABEL_SUPPORT define to use AFS_STRUCT_INIT.
Note, there is still a requirement that the order of initializers match
the order of the elements within the structure, but it should be easier
to verify that the initializers are in the proper order.
Use a consistent alignment, and add trailing comma on the last
element.
There are no functional changes made by this commit.
Reviewed-on: https://gerrit.openafs.org/16289
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
(cherry picked from commit 7c28b99490b75475ed9130526c536ae0e354e064)
Change-Id: I8faa4b497f2962bdd0a4ecb559e8b9288fd5c796
Reviewed-on: https://gerrit.openafs.org/16382
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
src/afs/afs_dcache.c | 66 +++++++++++++++---------------------------------
src/afs/afs_fetchstore.c | 54 ++++++++++++---------------------------
src/config/stds.h | 6 +++++
src/rx/xdr_len.c | 28 ++++++--------------
src/rx/xdr_mem.c | 28 ++++++--------------
src/rx/xdr_rx.c | 28 ++++++--------------
6 files changed, 66 insertions(+), 144 deletions(-)
--
OpenAFS Master Repository