qt6-bb10/tests/auto/corelib
Volker Hilsheimer 0be9ebcc22 JNI: replace va_arg helper with variadic template
Android 15 (at least) seems to have changed how float arguments are
passed to native functions, breaking our (conceptually correct) code for
processing the va_arg list into a list of static argument types of the
function implementation.

To fix this, we have to move away from using a va_arg function, and
register a function with statically typed arguments instead.

Use a template function that we instantiate with variadic arguments
deduced from the actual function, using a factory-helper that generates
a JNINativeMethod struct with that template instantiation as the
function pointer. Move all of that into a struct where we can also
declare the signature string as compile-time constant without cluttering
the namespace with static objects.

We can now remove the helpers that took care of type promotion in va_arg
functions, and of the tuple-construction from a va_list.

As a drive-by, don't cast function pointers to void *; it's strictly
speaking undefined behavior in C and should have generated a compiler
warning, if not a hard error [1]. We must initialize the
JNINativeMethod::fnPtr member with the address of the function pointer
instead.

[1] https://port70.net/~nsz/c/c11/n1570.html#6.3.2.3p8

Also, declare the native method as the JNICALL calling convention. That
is only defined on Windows, so makes no difference in practice, but it's
the correct thing to do anyway.

Fixes: QTBUG-132410
Change-Id: I190b95fcbcd07cf99c6765fa426c3c351f91994a
Reviewed-by: Volker Krause <vkrause@kde.org>
(cherry picked from commit e91a17873ee4ae58d369b8eb70029cf895b31d03)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 103aa5afb2d95f883daea41715c97455550285b2)
2025-01-13 14:52:09 +01:00
..
animation Change license for tests files 2024-02-04 09:56:42 +01:00
global Android: Fix logging of the category 2024-11-26 20:37:15 +00:00
io tst_QSaveFile: QVERIFY the commit() return value in symlink() test 2025-01-13 13:50:28 +00:00
ipc Add REUSE.toml files 2024-11-07 08:38:49 +01:00
itemmodels QConcatenateTablesProxyModel: react to row and column moves 2024-09-13 17:44:05 +00:00
kernel JNI: replace va_arg helper with variadic template 2025-01-13 14:52:09 +01:00
mimetypes Add REUSE.toml files 2024-11-07 08:38:49 +01:00
platform Android: fix tst_android::testFullScreenDimensions() 2024-12-04 15:34:32 +00:00
plugin QUuid: restore sorting order of Qt < 6.8 2024-10-22 13:15:24 +00:00
serialization Add REUSE.toml files 2024-11-07 08:38:49 +01:00
text Q{Any,Utf8}StringView: fix construction from arrays of unknown size 2024-12-16 20:45:24 +00:00
thread Fix QtFuture::when{All,Any}() overload resolution 2025-01-02 19:19:36 +00:00
time Fix assertion failure on parsing Feb 29 in a non-leap year 2024-12-20 07:20:44 +00:00
tools Test that reset() and move assignment handles self-assignment 2025-01-06 17:09:41 +00:00
CMakeLists.txt tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00