[PATCH] x86/asm: add commas to BUILD_BUG_ON

Jan Beulich posted 1 patch 1 month, 3 weeks ago
Failed in applying to current master (apply log)
[PATCH] x86/asm: add commas to BUILD_BUG_ON
Posted by Jan Beulich 1 month, 3 weeks ago
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.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/include/asm/asm_defns.h
+++ b/xen/arch/x86/include/asm/asm_defns.h
@@ -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)                        \
Re: [PATCH] x86/asm: add commas to BUILD_BUG_ON
Posted by Andrew Cooper 1 month, 3 weeks ago
On 06/03/2024 7:34 am, Jan Beulich wrote:
> 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.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>

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.