Fix compiler warnings
ClosedPublic

Authored by apol on Mar 15 2020, 8:00 PM.

Details

Reviewers
zzag
Group Reviewers
KWin
Commits
R108:cca0e15b455b: Fix compiler warnings
Summary

No need to keep them around for no reason.

Test Plan

Tested the plugins I thought could be affected. Have been using it for a couple of days without problems

Diff Detail

Repository
R108 KWin
Branch
master
Lint
Lint ErrorsExcuse: yyy
SeverityLocationCodeMessage
Errorcomposite.h:203CppcheckunknownMacro
Errorinput.h:310CppcheckunknownMacro
Errorinput.h:310CppcheckunknownMacro
Errorinput.h:310CppcheckunknownMacro
Errorlibkwineffects/kwinglobals.h:150CppcheckunknownMacro
Errorutils.h:123CppcheckunknownMacro
Errorutils.h:123CppcheckunknownMacro
Errorutils.h:123CppcheckunknownMacro
Unit
No Unit Test Coverage
Build Status
Buildable 23770
Build 23788: arc lint + arc unit
apol created this revision.Mar 15 2020, 8:00 PM
Restricted Application added a project: KWin. · View Herald TranscriptMar 15 2020, 8:00 PM
Restricted Application added a subscriber: kwin. · View Herald Transcript
apol requested review of this revision.Mar 15 2020, 8:00 PM
zzag added a subscriber: zzag.Mar 16 2020, 7:32 AM
zzag added inline comments.
debug_console.cpp
713

According to Qt documentation, we should interpret QVariant::Type as QMetaType::Type.

Although this function is declared as returning QVariant::Type, the return value should be interpreted as QMetaType::Type

https://doc.qt.io/qt-5/qvariant.html#type

effects/screenshot/screenshot.cpp
661

Do compilers bark about using c-style casts?

main_wayland.cpp
264

Indentation is off.

plugins/kdecorations/aurorae/src/aurorae.cpp
599

Unrelated side note: this is really wrong!

wayland_server.cpp
734

Unrelated side note: I don't get why Qt folks deprecated toSet(). Range-based initialization looks very clunky if you ask me.

apol added inline comments.Mar 16 2020, 2:20 PM
effects/screenshot/screenshot.cpp
661

The warning is:
kwin/effects/screenshot/screenshot.cpp:671:23: warning: cast from 'uchar *' (aka 'unsigned char *') to 'uint *' (aka 'unsigned int *') increases required alignment from 1 to 4 [-Wcast-align]

apol added inline comments.Mar 16 2020, 2:22 PM
wayland_server.cpp
734

I don't get it either.

apol updated this revision to Diff 77734.Mar 16 2020, 2:22 PM

Address comments by Vlad

zzag added a comment.Mar 16 2020, 3:22 PM

Perhaps it would be worth to split this patch because it fixes a lot of issues. Overall, +1.

effects/screenshot/screenshot.cpp
661

Coding style nitpick: add whitespace before *.

671

Looks like you forgot to add reinterpret_cast.

apol updated this revision to Diff 77742.Mar 16 2020, 3:29 PM

add space

apol updated this revision to Diff 77752.Mar 16 2020, 5:21 PM

Properly use QProcess

zzag added inline comments.Mar 17 2020, 7:56 AM
debug_console.cpp
713

Could you please revert this change? The documentation says that we should use QMetaType.

I assume the compiler doesn't like conversions between QVariant::Type and QMetaType::Type. If that's the case, we could cast the return value of value.type() or use value.userType() as Qt folks do.

apol marked 2 inline comments as done.Mar 17 2020, 12:39 PM
apol added inline comments.
debug_console.cpp
713

It doesn't make much sense since QVartiant's are defined in terms of QMetaType: SizeF = QMetaType::QSizeF.

But sure, changing for your peace of mind.

apol marked an inline comment as done.Mar 17 2020, 12:41 PM
apol updated this revision to Diff 77819.Mar 17 2020, 12:41 PM

Prefer using switch() with int to mute the warning

zzag added inline comments.Mar 17 2020, 1:35 PM
effects/showfps/showfps.cpp
126–127

wasRunning is unused.

main_wayland.cpp
262–264

Could you please walk me through this change? Why do we need to call setProgram()?

apol marked an inline comment as done.Mar 17 2020, 1:44 PM
apol added inline comments.
main_wayland.cpp
262–264

void start(const QString &command, OpenMode mode = ReadWrite); is deprecated.

We could also use
void start(const QString &program, const QStringList &arguments, OpenMode mode = ReadWrite);

zzag added inline comments.Mar 17 2020, 1:45 PM
main_wayland.cpp
262–264

Is it deprecated in Qt 5.15?

zzag accepted this revision.Mar 17 2020, 2:00 PM
zzag added inline comments.
effects/showfps/showfps.cpp
126–127

Please address this comment before landing.

plugins/platforms/virtual/egl_gbm_backend.cpp
197

nit: add whitespace before *

This revision is now accepted and ready to land.Mar 17 2020, 2:00 PM
apol marked an inline comment as done.Mar 17 2020, 2:07 PM
This revision was automatically updated to reflect the committed changes.
zzag added a comment.Apr 23 2020, 1:43 PM

This change broke the show fps effect.

zzag added a comment.Apr 24 2020, 6:28 AM

This change broke launching applications with arguments, e.g. dbus-run-session kwin_wayland --width 1920 --height 1080 --xwayland "kate file.txt"