[PATCH] tcg: Adjust NONNULL annotation on *_diff functions

Richard Henderson posted 1 patch 3 weeks, 5 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20261027230816.201808-1-richard.henderson@linaro.org
Maintainers: Richard Henderson <richard.henderson@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>
include/tcg/tcg.h | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
[PATCH] tcg: Adjust NONNULL annotation on *_diff functions
Posted by Richard Henderson 3 weeks, 5 days ago
In tcg/sparc64 we use tcg_tbrel_diff with NULL as a negative
addend in a relocation.

Fixes: b0b6701a4018 ("tcg: Annotate functions in tcg.h with QEMU_*_NONNULL")
Reported-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 include/tcg/tcg.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h
index 8f409b23b7..3dc26b919d 100644
--- a/include/tcg/tcg.h
+++ b/include/tcg/tcg.h
@@ -881,7 +881,6 @@ static inline TCGLabel *arg_label(TCGArg i)
  * This version relies on GCC's void pointer arithmetic to get the
  * correct result.
  */
-QEMU_ARG_NONNULL
 static inline ptrdiff_t tcg_ptr_byte_diff(const void *a, const void *b)
 {
     return a - b;
@@ -895,7 +894,7 @@ static inline ptrdiff_t tcg_ptr_byte_diff(const void *a, const void *b)
  * Produce a pc-relative difference, from the current code_ptr
  * to the destination address.
  */
-QEMU_ARG_NONNULL
+QEMU_ARG_LIST_NONNULL(1)
 static inline ptrdiff_t tcg_pcrel_diff(TCGContext *s, const void *target)
 {
     return tcg_ptr_byte_diff(target, tcg_splitwx_to_rx(s->code_ptr));
@@ -909,7 +908,7 @@ static inline ptrdiff_t tcg_pcrel_diff(TCGContext *s, const void *target)
  * Produce a difference, from the beginning of the current TB code
  * to the destination address.
  */
-QEMU_ARG_NONNULL
+QEMU_ARG_LIST_NONNULL(1)
 static inline ptrdiff_t tcg_tbrel_diff(TCGContext *s, const void *target)
 {
     return tcg_ptr_byte_diff(target, tcg_splitwx_to_rx(s->code_buf));
-- 
2.53.0


Re: [PATCH] tcg: Adjust NONNULL annotation on *_diff functions
Posted by Philippe Mathieu-Daudé 3 weeks, 4 days ago
On 28/10/26 00:08, Richard Henderson wrote:
> In tcg/sparc64 we use tcg_tbrel_diff with NULL as a negative
> addend in a relocation.
> 
> Fixes: b0b6701a4018 ("tcg: Annotate functions in tcg.h with QEMU_*_NONNULL")
> Reported-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   include/tcg/tcg.h | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>

Re: [PATCH] tcg: Adjust NONNULL annotation on *_diff functions
Posted by Pierrick Bouvier 3 weeks, 5 days ago
On 10/27/2026 3:08 PM, Richard Henderson wrote:
> In tcg/sparc64 we use tcg_tbrel_diff with NULL as a negative
> addend in a relocation.
> 
> Fixes: b0b6701a4018 ("tcg: Annotate functions in tcg.h with QEMU_*_NONNULL")
> Reported-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>  include/tcg/tcg.h | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 

Compiles successfully on a sparc64 cross container.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Tested-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>

Regards,
Pierrick