Skip to contentSkip to conversation

x86/asm: add commas to BUILD_BUG_ON

PATCH In review Jan Beulich 2 participants 2 messages Mar 6, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/asm: add commas to BUILD_BUG_ON

In light of recent observations with how macros are handled by gas, let's play by what we informally set for ourselves as a guideline: Use commas to separate parameters/arguments.

xen/arch/x86/include/asm/asm_defns.h +2 -2
@@ -82,13 +82,13 @@ register unsigned long current_stack_poi
 
 #ifdef __ASSEMBLY__
 
-.macro BUILD_BUG_ON condstr cond:vararg
+.macro BUILD_BUG_ON condstr, cond:vararg
         .if \cond
         .error "Condition \"\condstr\" not satisfied"
         .endif
 .endm
 /* preprocessor macro to make error message more user friendly */
-#define BUILD_BUG_ON(cond) BUILD_BUG_ON #cond cond
+#define BUILD_BUG_ON(cond) BUILD_BUG_ON #cond, cond
 
 #ifdef HAVE_AS_QUOTED_SYM
 #define SUBSECTION_LBL(tag)                        \
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Jan Beulich

In light of recent observations with how macros are handled by gas, let's play by what we informally set for ourselves as a guideline: Use commas to separate parameters/arguments.

However, there are some other examples wanting the same treatment.

alternative-asm.h:14:.macro altinstruction_entry orig repl feature orig_len repl_len pad_len
asm-defns.h:32:.macro INDIRECT_BRANCH insn:req arg:req asm_defns.h:284:.macro RESTORE_ALL adj=0 compat=0 spec_ctrl_asm.h:107:.macro DO_OVERWRITE_RSB tmp=rax xu

Preferably, fix all of these in one go.

As for observations about the other architectures, PPC uses commas everywhere.  RISC-V has no .macro's.  ARM looks to be a 50/50 mix.