From 165e9039a73031428ed6d0120b88b128b8d76cdf Mon Sep 17 00:00:00 2001 From: tastytea Date: Sat, 12 Jan 2019 17:39:20 +0100 Subject: [PATCH] Added more warnings for debug builds, removed superfluous consts --- CMakeLists.txt | 3 ++- src/interface_qt.cpp | 4 ++-- src/interface_qt.hpp | 4 ++-- src/interface_text.cpp | 16 ++++++++-------- src/interface_text.hpp | 16 ++++++++-------- src/whyblocked.cpp | 12 ++++++------ src/whyblocked.hpp | 12 ++++++------ 7 files changed, 34 insertions(+), 33 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 688d9ce..e6fa5d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,8 @@ set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) -set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -g -Og") +set(CMAKE_CXX_FLAGS_DEBUG + "${CMAKE_CXX_FLAGS_DEBUG} -Wpedantic -Wall -Wextra -g -Og -fno-omit-frame-pointer") set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOUIC ON) diff --git a/src/interface_qt.cpp b/src/interface_qt.cpp index a425be5..09d29fc 100644 --- a/src/interface_qt.cpp +++ b/src/interface_qt.cpp @@ -1,5 +1,5 @@ /* This file is part of whyblocked. - * Copyright © 2018 tastytea + * Copyright © 2018, 2019 tastytea * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -447,7 +447,7 @@ const Dialogdata DialogAdd::get_data() const return data; } -const void DialogAdd::set_data(const Dialogdata &data) +void DialogAdd::set_data(const Dialogdata &data) { text_user->setText(QString::fromStdString(data.user)); radio_blocked->setChecked(data.blocked); diff --git a/src/interface_qt.hpp b/src/interface_qt.hpp index 928aa96..2acb99d 100644 --- a/src/interface_qt.hpp +++ b/src/interface_qt.hpp @@ -1,5 +1,5 @@ /* This file is part of whyblocked. - * Copyright © 2018 tastytea + * Copyright © 2018, 2019 tastytea * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -79,7 +79,7 @@ class DialogAdd : public QDialog, private Ui::DialogAdd public: explicit DialogAdd(QMainWindow *parent = nullptr); - const void set_data(const Dialogdata &data); + void set_data(const Dialogdata &data); private: const Dialogdata get_data() const; diff --git a/src/interface_text.cpp b/src/interface_text.cpp index 51e9b17..05eec4a 100644 --- a/src/interface_text.cpp +++ b/src/interface_text.cpp @@ -44,7 +44,7 @@ const string Text::get_answer(const QString &question) return answer; } -const bool Text::askblocked() +bool Text::askblocked() { while (true) { @@ -61,7 +61,7 @@ const bool Text::askblocked() } } -const void Text::askrecipes(const string &user) +void Text::askrecipes(const string &user) { while (true) { @@ -86,7 +86,7 @@ const void Text::askrecipes(const string &user) } } -const void Text::add() +void Text::add() { const string user = get_answer(tr("User or instance")); int blocked; @@ -109,7 +109,7 @@ const void Text::add() askrecipes(user); } -const void Text::edit() +void Text::edit() { result_details olddata; const string olduser = get_answer(tr("User or instance")); @@ -170,7 +170,7 @@ const void Text::edit() } } -const void Text::remove() +void Text::remove() { const string user = get_answer(tr("User or instance")); @@ -180,7 +180,7 @@ const void Text::remove() } } -const void Text::view() +void Text::view() { result_view result; if (database::view(result)) @@ -201,7 +201,7 @@ const void Text::view() } } -const void Text::details() +void Text::details() { const string user = get_answer(tr("User or instance")); { @@ -231,7 +231,7 @@ const void Text::details() } } -const void Text::help() +void Text::help() { cout << tr( "Type add, edit, remove, view or details. Or just the first letter.") diff --git a/src/interface_text.hpp b/src/interface_text.hpp index 4b83bbb..9b592e9 100644 --- a/src/interface_text.hpp +++ b/src/interface_text.hpp @@ -31,14 +31,14 @@ public: private: const string get_answer(const QString &question); - const bool askblocked(); - const void askrecipes(const string &user); - const void add(); - const void edit(); - const void remove(); - const void view(); - const void details(); - const void help(); + bool askblocked(); + void askrecipes(const string &user); + void add(); + void edit(); + void remove(); + void view(); + void details(); + void help(); }; #endif // INTERFACE_TEXT_HPP diff --git a/src/whyblocked.cpp b/src/whyblocked.cpp index 853e91e..02a1c0b 100644 --- a/src/whyblocked.cpp +++ b/src/whyblocked.cpp @@ -1,5 +1,5 @@ /* This file is part of whyblocked. - * Copyright © 2018 tastytea + * Copyright © 2018, 2019 tastytea * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -53,7 +53,7 @@ const string get_filepath() return filepath; } -const bool database::add_block(const string &user, const int blocked, +bool database::add_block(const string &user, const int blocked, const string &reason) { try @@ -72,7 +72,7 @@ const bool database::add_block(const string &user, const int blocked, return true; } -const bool database::add_receipt(const string &user, const string &receipt) +bool database::add_receipt(const string &user, const string &receipt) { try { @@ -90,7 +90,7 @@ const bool database::add_receipt(const string &user, const string &receipt) return true; } -const bool database::remove(const string &user) +bool database::remove(const string &user) { try { @@ -111,7 +111,7 @@ const bool database::remove(const string &user) return true; } -const bool database::view(result_view &result, const string &sql_query) +bool database::view(result_view &result, const string &sql_query) { try { @@ -146,7 +146,7 @@ const bool database::view(result_view &result, const string &sql_query) return true; } -const bool database::details(const string &user, result_details &result) +bool database::details(const string &user, result_details &result) { try { diff --git a/src/whyblocked.hpp b/src/whyblocked.hpp index 8a263b1..8bee863 100644 --- a/src/whyblocked.hpp +++ b/src/whyblocked.hpp @@ -1,5 +1,5 @@ /* This file is part of whyblocked. - * Copyright © 2018 tastytea + * Copyright © 2018, 2019 tastytea * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,12 +28,12 @@ using result_details = std::tuple>; const string get_filepath(); namespace database { - const bool add_block(const string &user, const int blocked, + bool add_block(const string &user, const int blocked, const string &reason); - const bool add_receipt(const string &user, const string &receipt); - const bool remove(const string &user); - const bool view(result_view &result, const string &sql_query = ""); - const bool details(const string &user, result_details &result); + bool add_receipt(const string &user, const string &receipt); + bool remove(const string &user); + bool view(result_view &result, const string &sql_query = ""); + bool details(const string &user, result_details &result); } #endif // WHYBLOCKED_HPP