From a1b28bba9d918e22476befee2db6f83525bfb208 Mon Sep 17 00:00:00 2001 From: Assam Boudjelthia Date: Tue, 17 Oct 2023 14:35:19 +0300 Subject: [PATCH] JNI: fix error float argument to 'va_arg' is promotable If the native method contains a jfloat parameter, I get the warning/error: Second argument to 'va_arg' is of promotable type 'JNITypeForArg' (aka 'float'); this va_arg has undefined behavior because arguments will be promoted to 'double' Change-Id: I8e8ee256b9bea01585b5f70554ba2fc537e2c94d Reviewed-by: Volker Hilsheimer --- src/corelib/kernel/qjnitypes.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/corelib/kernel/qjnitypes.h b/src/corelib/kernel/qjnitypes.h index 6b64e5daea6..bedf368e309 100644 --- a/src/corelib/kernel/qjnitypes.h +++ b/src/corelib/kernel/qjnitypes.h @@ -235,6 +235,7 @@ template <> struct PromotedType { using Type = int; }; template <> struct PromotedType { using Type = unsigned int; }; template <> struct PromotedType { using Type = int; }; template <> struct PromotedType { using Type = unsigned int; }; +template <> struct PromotedType { using Type = double; }; // Map any QJniObject type to jobject; that's what's on the va_list template