qt5base-lts/tests/auto/corelib
Martin Storsjö 70df6052d8 tst_QPluginLoader: Simplify creating a fake pointer in fakeplugin.cpp
When assigning multiple variables to a specific section, both GCC
and Clang legitimately error out if those variables wouldn't end
up in the same section (e.g. if one of them is going to a read-only
section while the other one is going to a read-write section).

In C++, when a seemingly const variable needs dynamic initialization,
it needs to be stored in a read-write section.

Clang 13 changed internals for how some constants are materialized.
Now, when a variable is initialized with an expression containing
plain old fashioned casts, it is considered to be potentially
runtime initialized (at the point when section assignment conflicts
is evaluated). Therefore, Clang 13 errors out on fakeplugin.cpp
with errors like:

    fakeplugin.cpp:36:39: error: 'message' causes a section type conflict with 'pluginSection'
    QT_PLUGIN_METADATA_SECTION const char message[] = "QTMETADATA";
                                          ^
    fakeplugin.cpp:32:40: note: declared here
    QT_PLUGIN_METADATA_SECTION void *const pluginSection = (void*)(0xc0ffeec0ffeeL);
                                           ^

See https://bugs.llvm.org/show_bug.cgi?id=51442 for discussion
on the matter in Clang.

To simplify things, just initialize the fake pointers as regular
uintptr_t instead, avoiding the whole matter. This produces the
exact same contents in the section as before.

For what it's worth, the actual manually constructed metadata in
fakeplugin.cpp doesn't seem to have any effect on running the
QPluginLoader tests on either ELF or MachO right now.

Change-Id: Ib84a2ceb20cb8e3a1bb5132a5715538e08049616
Pick-to: 6.2 6.1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-08-20 22:19:58 +03:00
..
animation Avoid use after free in tst_qsequentialanimationgroup 2021-06-02 16:45:23 +02:00
global tests: Remove unused SRCDIR defines 2021-08-17 12:41:57 +00:00
io Use a scope-guard to take care of process deletion in a test 2021-08-17 19:18:54 +02:00
itemmodels emit layoutAboutToBeChanged timely 2021-07-20 21:27:27 +01:00
kernel QVariant: Tolerate QObject* metatypes without QMetaObject 2021-08-10 13:07:18 +02:00
mimetypes Fix BASE argument of qt_add_resources 2021-05-18 16:02:52 +02:00
platform Android: Add runOnMainAndroidThread() under QNativeInterface 2021-05-26 23:24:11 +00:00
plugin tst_QPluginLoader: Simplify creating a fake pointer in fakeplugin.cpp 2021-08-20 22:19:58 +03:00
serialization tests: Remove unused SRCDIR defines 2021-08-17 12:41:57 +00:00
text Improve and simplify tst_QByteArray's tests 2021-08-19 15:06:49 +02:00
thread QtConcurrent::run: support non default-constructible return types 2021-08-18 09:41:55 +02:00
time Fix and clean up utterly confused (and confusing) transition tests 2021-06-15 16:58:46 +02:00
tools QS(V)/QBA(V)/QL1S::lastIndexOf: fix the offset calculations 2021-08-19 01:55:01 +02:00
CMakeLists.txt Add tests for QAndroidApplication's sdkVersion and activity 2021-05-13 01:41:36 +03:00