[PATCH v2 1/7] target/sparc: Allow TRANS macro with no extra arguments

Richard Henderson posted 7 patches 5 months, 1 week ago
Maintainers: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>, Artyom Tarasenko <atar4qemu@gmail.com>
[PATCH v2 1/7] target/sparc: Allow TRANS macro with no extra arguments
Posted by Richard Henderson 5 months, 1 week ago
Use ## to drop the preceding comma if __VA_ARGS__ is empty.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/sparc/translate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/sparc/translate.c b/target/sparc/translate.c
index b922e53bf1..336583beab 100644
--- a/target/sparc/translate.c
+++ b/target/sparc/translate.c
@@ -2487,7 +2487,7 @@ static int extract_qfpreg(DisasContext *dc, int x)
 
 #define TRANS(NAME, AVAIL, FUNC, ...) \
     static bool trans_##NAME(DisasContext *dc, arg_##NAME *a) \
-    { return avail_##AVAIL(dc) && FUNC(dc, __VA_ARGS__); }
+    { return avail_##AVAIL(dc) && FUNC(dc, ## __VA_ARGS__); }
 
 #define avail_ALL(C)      true
 #ifdef TARGET_SPARC64
-- 
2.43.0
Re: [PATCH v2 1/7] target/sparc: Allow TRANS macro with no extra arguments
Posted by Mark Cave-Ayland 4 months, 3 weeks ago
On 05/09/2025 12:51, Richard Henderson wrote:

> Use ## to drop the preceding comma if __VA_ARGS__ is empty.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   target/sparc/translate.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/target/sparc/translate.c b/target/sparc/translate.c
> index b922e53bf1..336583beab 100644
> --- a/target/sparc/translate.c
> +++ b/target/sparc/translate.c
> @@ -2487,7 +2487,7 @@ static int extract_qfpreg(DisasContext *dc, int x)
>   
>   #define TRANS(NAME, AVAIL, FUNC, ...) \
>       static bool trans_##NAME(DisasContext *dc, arg_##NAME *a) \
> -    { return avail_##AVAIL(dc) && FUNC(dc, __VA_ARGS__); }
> +    { return avail_##AVAIL(dc) && FUNC(dc, ## __VA_ARGS__); }
>   
>   #define avail_ALL(C)      true
>   #ifdef TARGET_SPARC64

Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>


ATB,

Mark.