aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2022-02-01 08:00:04 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2022-02-01 08:00:04 +0100
commit45da05715cd75cb17e13516d534c4a48ec023582 (patch)
treead3dd0c1d6bc31e037fc97ef3fc9f925841c4c34
parent7f5119f81fdfa2cc97df91785dcce4798b0700cf (diff)
parentf441fabc655a021e161e59f26c302b9a94b5c3fc (diff)
downloadqmenumodel-45da05715cd75cb17e13516d534c4a48ec023582.tar.gz
qmenumodel-45da05715cd75cb17e13516d534c4a48ec023582.tar.bz2
qmenumodel-45da05715cd75cb17e13516d534c4a48ec023582.zip
Merge branch 'tari01-pr/cleanup-compile-flags'
Attributes GH PR #19: https://github.com/AyatanaIndicators/qmenumodel/pull/19
-rw-r--r--.build.yml5
-rw-r--r--CMakeLists.txt9
-rw-r--r--libqmenumodel/src/ayatanamenuaction.cpp7
-rw-r--r--libqmenumodel/src/ayatanamenumodel.cpp8
-rw-r--r--libqmenumodel/src/ayatanamenumodelevents.cpp6
-rw-r--r--libqmenumodel/src/converter.cpp27
-rw-r--r--tests/client/actiongrouptest.cpp8
-rw-r--r--tests/script/dbusmenuscript.h4
8 files changed, 43 insertions, 31 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
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
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 <http://www.gnu.org/licenses/>.
*
- * Authors: Nick Dedekind <nick.dedekind@canonical.com>
+ * Authors:
+ * Nick Dedekind <nick.dedekind@canonical.com>
+ * Robert Tari <robert@tari.in>
*/
#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<AyatanaMenuActionRemoveEvent*>(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 <http://www.gnu.org/licenses/>.
*
- * Authors: Lars Uebernickel <lars.uebernickel@canonical.com>
+ * Authors:
+ * Lars Uebernickel <lars.uebernickel@canonical.com>
+ * Robert Tari <robert@tari.in>
*/
#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 <nick.dedekind@canonical.com
+ * Robert Tari <robert@tari.in>
*/
#include <glib-object.h>
@@ -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 <renato@canonical.com>
* Marco Trevisan <marco.trevisan@canonical.com>
+ * Robert Tari <robert@tari.in>
*/
#include <glib.h>
@@ -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<ulong>());
break;
- case QVariant::Map:
+ case QMetaType::QVariantMap:
{
GVariantBuilder *b;
- GVariant *dict;
b = g_variant_builder_new(G_VARIANT_TYPE_VARDICT);
QMapIterator<QString, QVariant> 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 <renato@canonical.com>
+ * Robert Tari <robert@tari.in>
*/
#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 <renato@canonical.com>
+ * Robert Tari <robert@tari.in>
*/
#ifndef DBUSMENUSCRIPT_H
-#define DBUSMENUSCRITP_H
+#define DBUSMENUSCRIPT_H
#include <QObject>
#include <QDBusInterface>