qtdeclarative/tools
Michael Weghorn f7a64d2fc0 QmltcCompiler: Adhere to Compare requirement ("!(a < a)")
The Compare requirements [1] say:

> The return value of the function call operation applied to an object of
> a type satisfying Compare, when contextually converted to bool, yields
> true if the first argument of the call appears before the second in the
> strict weak ordering relation induced by this type, and false otherwise.

That requirement was violated here, because passing
the same value for both arguments would return true,
since the

    inlineComponentB->inherits(inlineComponentA)

check returns true when both inline components
are the same.

Add an equality check to fix that.

Fixes a build failure when building with
CXXFLAGS='-D_GLIBCXX_DEBUG':

    /usr/include/c++/13/bits/stl_algo.h:4892:
    In function:
        void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter =
        QList<variant<QString, monostate> >::iterator; _Compare =
        QmltcCompiler::compile(const QmltcCompilerInfo&)::<lambda(const
        QmltcCompiler::InlineComponentOrDocumentRootName&, const
        QmltcCompiler::InlineComponentOrDocumentRootName&)>]

    Error: comparison doesn't meet irreflexive requirements, assert(!(a < a)).

    Objects involved in the operation:
        instance "functor" @ 0x7ffec14329f8 {
          type = QmltcCompiler::compile(QmltcCompilerInfo const&)::{lambda(std::variant<QString, std::monostate> const&, std::variant<QString, std::monostate> const&)#1};
        }
        iterator::value_type "ordered type"  {
          type = std::variant<QString, std::monostate>;
        }
    Aborted (core dumped)
    ninja: build stopped: subcommand failed.

GDB backtrace:

    Program terminated with signal SIGABRT, Aborted.
    #0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
    44      ./nptl/pthread_kill.c: No such file or directory.
    (gdb) bt
    #0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
    #1  0x00007fbe6b4a815f in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
    #2  0x00007fbe6b45a472 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
    #3  0x00007fbe6b4444b2 in __GI_abort () at ./stdlib/abort.c:79
    #4  0x00007fbe6b6a300d in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
    #5  0x0000560ae899bec4 in std::sort<QList<std::variant<QString, std::monostate> >::iterator, QmltcCompiler::compile(const QmltcCompilerInfo&)::<lambda(const QmltcCompiler::InlineComponentOrDocumentRootName&, const QmltcCompiler::InlineComponentOrDocumentRootName&)> >(QList<std::variant<QString, std::monostate> >::iterator, QList<std::variant<QString, std::monostate> >::iterator, struct {...}) (__first=..., __last=..., __comp=...)
        at /usr/include/c++/13/bits/stl_algo.h:4892
    #6  0x0000560ae898bd67 in QmltcCompiler::compile (this=0x7ffec1432e80, info=...) at /home/michi/development/git/qt5/qtdeclarative/tools/qmltc/qmltccompiler.cpp:85
    #7  0x0000560ae89264b6 in main (argc=23, argv=0x7ffec1434fc8) at /home/michi/development/git/qt5/qtdeclarative/tools/qmltc/main.cpp:284

[1] https://en.cppreference.com/w/cpp/named_req/Compare

Change-Id: Ie8934b8381ef217c1f8860ee110f6fa2aa0c86fa
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2023-12-08 13:14:50 +01:00
..
qml Remove resize guards from qml tool 2023-09-12 07:07:51 +02:00
qmlcachegen Compiler: Separate function prolog block and add validation of blocks 2023-08-04 09:34:09 +02:00
qmldom QmlDom: Avoid copying and detaching on iteration 2023-09-19 14:34:43 +02:00
qmleasing Remove Qt keywords from all headers 2022-12-09 11:55:10 +08:00
qmlformat qmlformat: fix formatting with -F option 2023-10-16 18:28:49 +02:00
qmlimportscanner Port from container::count() and length() to size() - V5 2022-10-13 00:18:35 +02:00
qmljs qmljs: Port to QCommandLineParser 2023-06-30 10:47:17 +02:00
qmljsrootgen qmljsrootgen: port to QCommandLineParser 2023-07-05 09:14:20 +02:00
qmllint QQmlSA: Create an abstraction layer for static analysis 2023-05-30 13:42:35 +02:00
qmlls qmlls: fix the order in which the build directory is obtained 2023-06-23 09:03:27 +02:00
qmlplugindump QtQml: Store singleton typename as UTF-8 QByteArray 2023-08-30 14:18:17 +02:00
qmlpreview Remove Qt keywords from all headers 2022-12-09 11:55:10 +08:00
qmlprofiler Remove Qt keywords from all headers 2022-12-09 11:55:10 +08:00
qmlscene Port to new Q_UNREACHABLE_RETURN() 2022-10-20 23:59:33 +02:00
qmltc QmltcCompiler: Adhere to Compare requirement ("!(a < a)") 2023-12-08 13:14:50 +01:00
qmltestrunner Change the license of all CMakeLists.txt and *.cmake files to BSD 2022-09-07 17:01:30 +02:00
qmltime Remove all QML_DECLARE_TYPE from src and tools 2023-11-18 07:37:33 +00:00
qmltyperegistrar qmltyperegistrar: Explicitly override any custom qdebug message pattern 2023-11-29 11:27:06 +00:00
svgtoqml Add tool for converting SVG to QML using Shapes 2023-11-24 17:34:03 +00:00
CMakeLists.txt qmlls: rebuild when modifying QML elements in C++ for CMake projects 2023-12-04 20:16:06 +01:00