aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-01-01Drop inline next to constexprAlexey Rusakov
Thanks to Sonar for reminding that constexpr implies inline.
2022-01-01Define destructors out-of-line when unique/scoped ptr are involvedAlexey Rusakov
Once visibility kicks in, MSVC changes its ways and tries to instantiate Private classes wrapped in smart pointers upon their occurence in the header file - which leads to build breakage because of a missing destructor. Usually making the outer class destructor out-of-line helps to fix this (see RoomEvent, for one example).
2022-01-01Try to fix building with MSVC with Qt pre-5.14Alexey Rusakov
MSVC is quite picky to redeclaration with __declspec(dllexport), judging it as changing the class of storage. This commit tries to reorder declarations so that MSVC is made aware of dllexport attribute on the first encounter rather than the second one.
2022-01-01Quotest: build with hidden visibility tooAlexey Rusakov
2022-01-01BUILD_SHARED_LIBS in most jobs; fix not finding libQuotient.so.*Alexey Rusakov
2021-12-29Use QLatin1String for event typeId'sAlexey Rusakov
Before all, this fixes the problem with double-initialising of type ids; it could have been fixed with a smaller change but EventTypeRegistry is fairly superfluous now when inline variables are a thing and it's possible to have an extensible registry system using literally pointers to the memory that are guaranteed to be unique. That being said, event_type_t is still QLatin1String and not a bare const char* (or void*), mostly to stay on the safe side when it comes to type identities: unlike const char*, QLatin1String's are deep-compared, meaning that matching for switchOnType (former visit) occurs a bit slower now. This may change in the future; but this is the first step in getting rid of EventTypeRegistry. This change means that initializeTypeId is no more needed; also, two static member functions, typeId() and matrixTypeId(), are being replaced with a single inline static member variable, TypeId. This commit doesn't apply that transition across the event types, meaning that you'll get a pile of warnings when compiling the library. These warnings will be tackled in further commits within this branch.
2021-12-29CI: Put the shared object configuration to the testAlexey Rusakov
For now on Linux with GCC only, with a plan to add Windows eventually.
2021-12-29CMakeLists.txt: apply -fvisibility=hiddenAlexey Rusakov
Also, -fvisibility-inlines-hidden is applied in a CMake-native way now. As can be expected, BUILDING_SHARED_QUOTIENT is set when a dynamic library is built while QUOTIENT_STATIC is set whenever static libQuotient is around (both for building it and for building with it).
2021-12-29Refactor EventFactory and move it out of _impl::Alexey Rusakov
Strictly speaking, EventFactory can be further instantiated if any client application figures they need a whole new base class for events and respectively a separate EventFactory specialisation for it. Where this whole commit started though was a linkage error because I did not plan to expose Quotient-specific logging categories for linkage (effectively, usage) from the client code - meanwhile the inline code of EventFactory uses qDebug(EVENTS), meaning I had to either add QUOTIENT_API to EVENTS or hide those invocations. This in turn led to trimming the EventFactory constructor back to trivial implementation and dropping the guard variable that was supposed to trace duplicate EventFactory<BaseEventT> objects for the same BaseEventT - with the reasoning that such situation is not really dangerous (unlike EventTypeRegistry double-initialisation fiasco, see #413), and at the same time it can be easily detected in the logs by duplicated factory method registration messages. And while I was at it, I replaced the meaningless bool in the return type of EventFactory<>::addMethod with the slightly more (but still barely) useful reference to the inserted factory method. One can (in theory) use it now if they need to turn some event JSON into an object of some specific event type or nullptr if the event type in the JSON payload doesn't match - but at the same rate (for now at least) one can call makeIfMatches<EventT>() directly. With this commit, both Quotest and Quaternion build and link using either Clang or GCC even under -fvisibility=hidden. However, running quotest now reproduces #413, which is a matter of event typeId infrastructure refactoring, coming in further commits.
2021-12-29Regenerate CS API filesAlexey Rusakov
2021-12-29operation.h.mustache: Add QUOTIENT_APIAlexey Rusakov
2021-12-29Add QUOTIENT_API throughout non-generated codeAlexey Rusakov
This include all (hopefully) classes/structures and functions that have non-inline definitions, as well as namespaces with Q_NAMESPACE since those have non-inline (as of Qt 5.15) QMetaObject - for that a new macro, QUO_NAMESPACE, has been devised to accommodate the lack of Q_NAMESPACE_EXPORT in Qt before 5.14.
2021-12-29Quotest: test sending and receiving custom eventsAlexey Rusakov
This seems to be the crux of #413.
2021-12-29Introduce quotient_export.hAlexey Rusakov
Instead of using CMake's generate_export_header macro, it's a bit easier to maintain a static file (that is not supposed to ever change) with necessary export/import/hidden visibility macros.
2021-12-27Key* strings: drop 'static'; add 'constexpr' where okAlexey Rusakov
2021-12-27Connection: Simplify room/user factory codeAlexey Rusakov
There's no need to return lambdas where pointers to specialised function templates would work just fine.
2021-12-27Quotest: add compile warnings from libQuotientAlexey Rusakov
2021-12-26Merge #528: Make canChangePassword available from QMLAlexey Rusakov
2021-12-25Make canChangePassword available from QMLCarl Schwan
2021-12-24Prune empty/ish call*event.cpp filesAlexey Rusakov
2021-12-24CI: Fix rm being run in the wrong directoryAlexey Rusakov
It's been alright with the comment inside the script.
2021-12-24CI: Move a comment outside of the scriptAlexey Rusakov
Comments inside shell scripts apparently break the flimsy GHA machinery.
2021-12-24CI: Add missing coverage filesAlexey Rusakov
2021-12-24Merge branch 'kitsune/sonar-coverage'Alexey Rusakov
2021-12-24Reinstate update-api jobsAlexey Rusakov
2021-12-24Don't strip lib from names in .gcov filesAlexey Rusakov
That apparently confuses Sonar as it fails to match the source files.
2021-12-24Analyse in 2 threadsAlexey Rusakov
2021-12-24Actually do and submit coverageAlexey Rusakov
...instead of hoping the thing will sort itself out because CLion does.
2021-12-24Merge Sonar invocation back to ci.ymlAlexey Rusakov
For coverage analysis to work, a test run is needed, making the overlap between ci.yaml and sonar.yml quite significant again. Note: 'update-api' option is temporarily dropped from the matrix to speed up the check. If things run fine, 'update-api' will come back.
2021-12-24Sonar: add coverage analysisAlexey Rusakov
2021-12-24Sonar: leave just one jobAlexey Rusakov
There's not much value in analysing the code without E2EE and with E2EE because E2EE is additive; and there's no plan to look close into the generated API code apart from what already ends up being committed.
2021-12-22Merge pull request #526 from quotient-im/kitsune/simpler-event-factoriesAlexey Rusakov
Simplify event factories
2021-12-22StateEventBase: force type to unknown if stateKey is not in JSONAlexey Rusakov
2021-12-22Simplify the code around EventFactory<>Alexey Rusakov
The former code assumed that EventFactory<> is just a class-level shell for a bunch of functions and a static data member that only exists to allow specialisations to occur for the whole group together. On top of that, setupFactory() and registerEventType() strived to protect this group from double registration coming from static variables in an anonymous namespace produced by REGISTER_EVENT_TYPE. The whole thing is now de-static-ed: resolving the factory now relies on class-static Event/RoomEvent/StateEventBase::factory variables instead of factory_t type aliases; and REGISTER_EVENT_TYPE produces non-static inline variables instead, obviating the need of registerEventType/setupFactory kludge.
2021-12-21Don't chain RoomEvent to Event factory any moreAlexey Rusakov
Objects derived from Event are not room events (in the spec sense) and never occur in the same arrays as room events; therefore this chaining has always been superfluous.
2021-12-21Add event_loader.h to CMakeListsAlexey Rusakov
Another forgotten header file.
2021-12-21Quotest: add a missing \n in the outputAlexey Rusakov
2021-12-17RoomMemberEvent: fix an off-by-one errorAlexey Rusakov
Also: extended quotest to cover member renames, not just user profile renames.
2021-12-10Merge pull request #523 from quotient-im/kitsune/ci-add-autotestsAlexey Rusakov
Add autotests to CI
2021-12-09Fix CI failure on macOSAlexey Rusakov
CMAKE_INSTALL_RPATH_USE_LINK_PATH is more universal than setting LD_LIBRARY_PATH Also: drop an extra slash in the path to installed quotest.
2021-12-08Test installed quotestAlexey Rusakov
This covers Quotient_INSTALL_TESTS setting.
2021-12-07CI: Put all build directories to ${{ runner.workspace }}/buildAlexey Rusakov
2021-12-07Fix valgrind invocation failureAlexey Rusakov
It turned out that, confusingly, ${{ runner.workspace }} refers to the directory above $GITHUB_WORKSPACE, which is why the previous commit ended up with valgrind not finding its suppressions.
2021-12-07Fix quotest invocation; use working-directoryAlexey Rusakov
2021-12-06autotests/: don't instantiate QApplicationAlexey Rusakov
Those tests don't even need an event loop.
2021-12-06Add execution of autotests to CIAlexey Rusakov
2021-12-05Drop 'qmc-example' from one last(?) placeAlexey Rusakov
2021-12-03Cleanup; drop an unused RoomAliasesEvent constructorAlexey Rusakov
Also, RoomAliasesEvent is to be completely gone after 0.7.
2021-12-03Add a couple of bare .h files to CMakeLists.txtAlexey Rusakov
These were missing from the commit introducing .h files to sources, highlighting the reason why .h files should be there...
2021-12-03Rely on GTAD 0.9 that calls clang-format itselfAlexey Rusakov
There was that ugly workaround in CMakeLists.txt to produce the list of files to be formatted and making a separate build target for clang-format. As GTAD 0.9 calls clang-format itself this workaround is no more necessary; generate-unformatted-api and format-api build targets are now gone, and clang-format is no more one-build-system-configuration behind GTAD on the list of files to handle.