From d23a290dae52eec26bb4fd772168f38bd6e59f4e Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Thu, 13 Jan 2022 12:51:32 +0100 Subject: Fix all build warnings --- libqmenumodel/src/ayatanamenuaction.cpp | 7 ++++--- libqmenumodel/src/ayatanamenumodel.cpp | 8 ++++---- libqmenumodel/src/ayatanamenumodelevents.cpp | 6 ++++-- libqmenumodel/src/converter.cpp | 27 ++++++++++++++------------- tests/client/actiongrouptest.cpp | 8 +++++--- tests/script/dbusmenuscript.h | 4 +++- 6 files changed, 34 insertions(+), 26 deletions(-) diff --git a/libqmenumodel/src/ayatanamenuaction.cpp b/libqmenumodel/src/ayatanamenuaction.cpp index 7e13b35..72d65af 100644 --- a/libqmenumodel/src/ayatanamenuaction.cpp +++ b/libqmenumodel/src/ayatanamenuaction.cpp @@ -1,5 +1,6 @@ /* * Copyright 2013 Canonical Ltd. + * Copyright 2022 Robert Tari * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -13,7 +14,9 @@ * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * - * Authors: Nick Dedekind + * Authors: + * Nick Dedekind + * Robert Tari */ #include "ayatanamenuaction.h" @@ -148,8 +151,6 @@ bool AyatanaMenuAction::event(QEvent* e) setState(umasce->state); return true; } else if (e->type() == AyatanaMenuActionRemoveEvent::eventType) { - AyatanaMenuActionRemoveEvent *umare = static_cast(e); - setValid(false); return true; } diff --git a/libqmenumodel/src/ayatanamenumodel.cpp b/libqmenumodel/src/ayatanamenumodel.cpp index 2c735e6..39ce0bc 100644 --- a/libqmenumodel/src/ayatanamenumodel.cpp +++ b/libqmenumodel/src/ayatanamenumodel.cpp @@ -1,5 +1,6 @@ /* * Copyright 2013 Canonical Ltd. + * Copyright 2022 Robert Tari * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -13,7 +14,9 @@ * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * - * Authors: Lars Uebernickel + * Authors: + * Lars Uebernickel + * Robert Tari */ #include "ayatanamenumodel.h" @@ -270,12 +273,10 @@ void AyatanaMenuModelPrivate::menuItemChanged(GObject *object, GParamSpec *pspec { GSequenceIter *it = (GSequenceIter *) user_data; GtkMenuTrackerItem *item; - GtkActionObservable *muxer; AyatanaMenuModel *model; gint position; item = (GtkMenuTrackerItem *) g_sequence_get (it); - muxer = _gtk_menu_tracker_item_get_observable (item); model = (AyatanaMenuModel *) g_object_get_qdata (G_OBJECT (item), ayatana_menu_model_quark ()); position = g_sequence_iter_get_position (it); @@ -928,7 +929,6 @@ char * AyatanaMenuModelPrivate::fullActionName(AyatanaMenuAction *action) GSequenceIter *iter; QByteArray bytes; const gchar *name; - gchar *full_name = NULL; bytes = action->name().toUtf8(); name = bytes.constData(); diff --git a/libqmenumodel/src/ayatanamenumodelevents.cpp b/libqmenumodel/src/ayatanamenumodelevents.cpp index 357b6be..70f2cfc 100644 --- a/libqmenumodel/src/ayatanamenumodelevents.cpp +++ b/libqmenumodel/src/ayatanamenumodelevents.cpp @@ -1,5 +1,6 @@ /* * Copyright 2013 Canonical Ltd. + * Copyright 2022 Robert Tari * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -15,6 +16,7 @@ * * Authors: * Nicholas Dedekind */ #include @@ -39,7 +41,7 @@ AyatanaMenuModelAddRowEvent::AyatanaMenuModelAddRowEvent(GPtrArray *_items, int position(_position) { if (items) { - for (gint i = 0; i < items->len; ++i) + for (guint i = 0; i < items->len; ++i) g_object_ref(g_ptr_array_index(items, i)); g_ptr_array_ref(items); } @@ -48,7 +50,7 @@ AyatanaMenuModelAddRowEvent::AyatanaMenuModelAddRowEvent(GPtrArray *_items, int AyatanaMenuModelAddRowEvent::~AyatanaMenuModelAddRowEvent() { if (items) { - for (gint i = 0; i < items->len; ++i) + for (guint i = 0; i < items->len; ++i) g_object_unref(g_ptr_array_index(items, i)); g_ptr_array_unref(items); } diff --git a/libqmenumodel/src/converter.cpp b/libqmenumodel/src/converter.cpp index 49ced63..98757da 100644 --- a/libqmenumodel/src/converter.cpp +++ b/libqmenumodel/src/converter.cpp @@ -1,5 +1,6 @@ /* * Copyright 2012-2016 Canonical Ltd. + * Copyright 2022 Robert Tari * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -16,6 +17,7 @@ * Authors: * Renato Araujo Oliveira Filho * Marco Trevisan + * Robert Tari */ #include @@ -164,29 +166,29 @@ GVariant* Converter::toGVariant(const QVariant &value) if (value.isNull() || !value.isValid()) return result; - switch(value.type()) { - case QVariant::Bool: + switch((QMetaType::Type)value.type()) { + case QMetaType::Bool: result = g_variant_new_boolean(value.toBool()); break; - case QVariant::ByteArray: + case QMetaType::QByteArray: result = g_variant_new_bytestring(value.toByteArray()); break; - case QVariant::Double: + case QMetaType::Double: result = g_variant_new_double(value.toDouble()); break; - case QVariant::Int: + case QMetaType::Int: result = g_variant_new_int32(value.toInt()); break; - case QVariant::LongLong: + case QMetaType::LongLong: result = g_variant_new_int64(value.toLongLong()); break; - case QVariant::String: + case QMetaType::QString: result = g_variant_new_string(qUtf8Printable(value.toString())); break; - case QVariant::UInt: + case QMetaType::UInt: result = g_variant_new_uint32(value.toUInt()); break; - case QVariant::ULongLong: + case QMetaType::ULongLong: result = g_variant_new_uint64(value.toULongLong()); break; case QMetaType::UChar: @@ -204,10 +206,9 @@ GVariant* Converter::toGVariant(const QVariant &value) case QMetaType::ULong: result = g_variant_new_uint64(value.value()); break; - case QVariant::Map: + case QMetaType::QVariantMap: { GVariantBuilder *b; - GVariant *dict; b = g_variant_builder_new(G_VARIANT_TYPE_VARDICT); QMapIterator i(value.toMap()); @@ -231,7 +232,7 @@ GVariant* Converter::toGVariant(const QVariant &value) g_variant_builder_unref(b); break; } - case QVariant::List: + case QMetaType::QVariantList: { GVariantBuilder *b = g_variant_builder_new(G_VARIANT_TYPE_TUPLE); @@ -242,7 +243,7 @@ GVariant* Converter::toGVariant(const QVariant &value) g_variant_builder_unref(b); break; } - case QVariant::StringList: + case QMetaType::QStringList: { GVariantBuilder *b = g_variant_builder_new(G_VARIANT_TYPE_STRING_ARRAY); diff --git a/tests/client/actiongrouptest.cpp b/tests/client/actiongrouptest.cpp index 3ab329c..f2621eb 100644 --- a/tests/client/actiongrouptest.cpp +++ b/tests/client/actiongrouptest.cpp @@ -1,5 +1,6 @@ /* * Copyright 2012 Canonical Ltd. + * Copyright 2022 Robert Tari * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -15,6 +16,7 @@ * * Authors: * Renato Araujo Oliveira Filho + * Robert Tari */ #include "qdbusmenumodel.h" @@ -138,7 +140,7 @@ private Q_SLOTS: void testActionName() { - QStateAction *act; + QStateAction *act = nullptr; getMenuAction(&act, 1); QCOMPARE(act->property("name").toString(), QString("Menu1Act")); } @@ -148,7 +150,7 @@ private Q_SLOTS: */ void testStringActionActivation() { - QStateAction *act; + QStateAction *act = nullptr; getMenuAction(&act, 1); act->activate(QVariant("42")); @@ -162,7 +164,7 @@ private Q_SLOTS: void testStringActionActivationByVariantString() { - QStateAction *act; + QStateAction *act = nullptr; getMenuAction(&act, 1); act->activateByVariantString("\"53\""); diff --git a/tests/script/dbusmenuscript.h b/tests/script/dbusmenuscript.h index 03c5ad3..ff6119d 100644 --- a/tests/script/dbusmenuscript.h +++ b/tests/script/dbusmenuscript.h @@ -1,5 +1,6 @@ /* * Copyright 2012 Canonical Ltd. + * Copyright 2022 Robert Tari * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -15,10 +16,11 @@ * * Authors: * Renato Araujo Oliveira Filho + * Robert Tari */ #ifndef DBUSMENUSCRIPT_H -#define DBUSMENUSCRITP_H +#define DBUSMENUSCRIPT_H #include #include -- cgit v1.2.3 From 59283b0aac2dc12e955a3dd9604cc129f19ef74a Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Thu, 13 Jan 2022 12:55:54 +0100 Subject: CMakeLists.txt: Clean up compilation flags --- CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bd3f3e8..7e11db6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,8 +25,13 @@ if(ENABLE_TESTS) endif() if(ENABLE_WERROR) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") + add_definitions("-Werror") +endif() + +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + add_definitions("-Weverything") +else() + add_definitions("-Wall") endif() # Standard install paths -- cgit v1.2.3 From f441fabc655a021e161e59f26c302b9a94b5c3fc Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Thu, 13 Jan 2022 12:56:46 +0100 Subject: .build.yml: Drop extra compilation flags and build with -Werror --- .build.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.build.yml b/.build.yml index a16fcf7..a5c1220 100644 --- a/.build.yml +++ b/.build.yml @@ -79,7 +79,6 @@ variables: build_scripts: - if [ ${DISTRO_NAME} == "debian" ];then - - export CFLAGS+=" -Wsign-compare -Wunused-parameter" - cppcheck --enable=warning,style,performance,portability,information,missingInclude . - fi - @@ -88,9 +87,9 @@ build_scripts: - scan-build $CHECKERS ./configure --prefix=/usr --enable-gtk-doc --enable-compile-warnings=maximum - elif [ -e ./CMakeLists.txt ]; then - if [ ${DISTRO_NAME} == "debian" ];then - - scan-build $CHECKERS cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_TESTS=ON + - scan-build $CHECKERS cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_WERROR=ON -DENABLE_TESTS=ON - else - - scan-build $CHECKERS cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE=ON + - scan-build $CHECKERS cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_WERROR=ON - fi - else - exit 1 -- cgit v1.2.3