Fix KGlobalAccel build with Qt 5.13 prerelease
ClosedPublic

Authored by mpyne on Dec 18 2018, 4:03 AM.

Details

Summary

After a recent system upgrade to Qt git dev branch (for upcoming 5.13), kglobalaccel started to fail to build due to problems compiling a moc file. Oddly, all other frameworks in KF5 (except those depending upon kglobalaccel) compiled fine.

I spent some time looking into several potential Qt moc or other issues, but to save you all the time I wasted on it, the essence is that you shouldn't #include "foo.moc" from within a C++ namespace. Previously this would have worked since only symbols relevant to the current C++ namespace were defined.

But with updated Qt, the moc generates files that rely on parts of the C++ standard library being available, and duly includes a line #include <memory>. At the top namespace level this works great. Including <memory> from within our own namespace works less well, producing error messages that cause LLVM to give up early.

I fix by just removing the entry since CMake is automoc'ing anyways. If we need to include the entry then moving it to the end of the file instead would probably work just as well. Note that moc is itself smart enough to capture the namespacing of the class we declare.

Test Plan

Completed build of KGlobalAccel, installs successfully, dependent modules install successfully, new Plasma desktop loads fine.

All 2 autotests still pass.

Diff Detail

Repository
R268 KGlobalAccel
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
mpyne created this revision.Dec 18 2018, 4:03 AM
Restricted Application added a project: Frameworks. · View Herald TranscriptDec 18 2018, 4:03 AM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
mpyne requested review of this revision.Dec 18 2018, 4:03 AM
apol accepted this revision.Dec 18 2018, 12:21 PM
apol added a subscriber: apol.

As a rule of thumb, I'd say it's just fine to remove moc includes if there's no Q_OBJECT or Q_GADGET on the cpp file.

This revision is now accepted and ready to land.Dec 18 2018, 12:21 PM
This revision was automatically updated to reflect the committed changes.