summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2025-01-25 23:04:23 -0700
committerLuke T. Shumaker <lukeshu@lukeshu.com>2025-01-27 21:34:32 -0700
commit508730301701ece981149f18bc515797cf2b9990 (patch)
tree87f743d15943f47bb55f0a675877b9f7f42e4597
parentbaee9e79e3296332c400749644eb557d6bb8c2a6 (diff)
lib9p: idl.gen: Fix extra newline after bitfields with no aliases
-rwxr-xr-xlib9p/idl.gen9
-rw-r--r--lib9p/include/lib9p/9p.generated.h2
2 files changed, 4 insertions, 7 deletions
diff --git a/lib9p/idl.gen b/lib9p/idl.gen
index 619c791..0b86246 100755
--- a/lib9p/idl.gen
+++ b/lib9p/idl.gen
@@ -277,12 +277,11 @@ enum {idprefix}version {{
case idl.Bitfield():
ret += f"typedef {c_typename(typ.prim)} {c_typename(typ)};\n"
names = [
- *reversed(
- [typ.bits[n] or f" {n}" for n in range(0, len(typ.bits))]
- ),
- "",
- *[k for k in typ.names if k not in typ.bits],
+ typ.bits[n] or f" {n}" for n in reversed(range(0, len(typ.bits)))
]
+ if aliases := [k for k in typ.names if k not in typ.bits]:
+ names.append("")
+ names.extend(aliases)
prefix = f"{idprefix.upper()}{typ.name.upper()}_"
namewidth = max(len(add_prefix(prefix, name)) for name in names)
diff --git a/lib9p/include/lib9p/9p.generated.h b/lib9p/include/lib9p/9p.generated.h
index 105cafc..99bc4ce 100644
--- a/lib9p/include/lib9p/9p.generated.h
+++ b/lib9p/include/lib9p/9p.generated.h
@@ -360,7 +360,6 @@ typedef uint32_t lib9p_setattr_t;
#define LIB9P_SETATTR_UID ((lib9p_setattr_t)(1<<1))
#define LIB9P_SETATTR_MODE ((lib9p_setattr_t)(1<<0))
-
/* size = 1 */
typedef uint8_t lib9p_lock_type_t;
#define LIB9P_LOCK_TYPE_RDLCK ((lib9p_lock_type_t)UINT8_C(0))
@@ -403,7 +402,6 @@ typedef uint32_t lib9p_lock_flags_t;
#define LIB9P_LOCK_FLAGS_RECLAIM ((lib9p_lock_flags_t)(1<<1))
#define LIB9P_LOCK_FLAGS_BLOCK ((lib9p_lock_flags_t)(1<<0))
-
/* size = 1 */
typedef uint8_t lib9p_lock_status_t;
#define LIB9P_LOCK_STATUS_SUCCESS ((lib9p_lock_status_t)UINT8_C(0))