Add [[maybe_unused]] to silence unhelpful warnings
This commit is contained in:
parent
0aa4bca6cc
commit
6304554358
16
cli.cpp
16
cli.cpp
@ -54,7 +54,7 @@ std::pair<bool, std::string> CLIHandler::user_add(const std::vector<std::string>
|
||||
return {true, ""};
|
||||
}
|
||||
|
||||
std::pair<bool, std::string> CLIHandler::user_change_pw(const std::vector<std::string> &args)
|
||||
std::pair<bool, std::string> CLIHandler::user_change_pw([[maybe_unused]] const std::vector<std::string> &args)
|
||||
{
|
||||
std::string username = args.at(0);
|
||||
std::string password = args.at(1);
|
||||
@ -81,13 +81,13 @@ std::pair<bool, std::string> CLIHandler::user_change_pw(const std::vector<std::s
|
||||
}
|
||||
}
|
||||
|
||||
std::pair<bool, std::string> CLIHandler::user_rename(const std::vector<std::string> &args)
|
||||
std::pair<bool, std::string> CLIHandler::user_rename([[maybe_unused]] const std::vector<std::string> &args)
|
||||
{
|
||||
|
||||
return {true, ""};
|
||||
}
|
||||
|
||||
std::pair<bool, std::string> CLIHandler::user_set_perms(const std::vector<std::string> &args)
|
||||
std::pair<bool, std::string> CLIHandler::user_set_perms([[maybe_unused]] const std::vector<std::string> &args)
|
||||
{
|
||||
auto userDao = this->db->createUserDao();
|
||||
std::string username = args.at(0);
|
||||
@ -107,7 +107,7 @@ std::pair<bool, std::string> CLIHandler::user_set_perms(const std::vector<std::s
|
||||
return {false, "User not found"};
|
||||
}
|
||||
|
||||
std::pair<bool, std::string> CLIHandler::user_list(const std::vector<std::string> &args)
|
||||
std::pair<bool, std::string> CLIHandler::user_list([[maybe_unused]] const std::vector<std::string> &args)
|
||||
{
|
||||
auto userDao = this->db->createUserDao();
|
||||
QueryOption o;
|
||||
@ -138,7 +138,7 @@ std::pair<bool, std::string> CLIHandler::user_show(const std::vector<std::string
|
||||
return {false, "User not found"};
|
||||
}
|
||||
|
||||
std::pair<bool, std::string> CLIHandler::page_list(const std::vector<std::string> &args)
|
||||
std::pair<bool, std::string> CLIHandler::page_list([[maybe_unused]] const std::vector<std::string> &args)
|
||||
{
|
||||
auto pageDao = this->db->createPageDao();
|
||||
QueryOption o;
|
||||
@ -163,7 +163,7 @@ std::pair<bool, std::string> CLIHandler::pageperms_set_permissions(const std::ve
|
||||
return {true, ""};
|
||||
}
|
||||
|
||||
std::pair<bool, std::string> CLIHandler::attach(const std::vector<std::string> &args)
|
||||
std::pair<bool, std::string> CLIHandler::attach([[maybe_unused]] const std::vector<std::string> &args)
|
||||
{
|
||||
/* TODO: consider authentication */
|
||||
pid_t pid = getpid();
|
||||
@ -245,12 +245,12 @@ std::pair<std::string, std::vector<std::string>> CLIHandler::splitCommand(std::s
|
||||
return {cmd, splitted};
|
||||
}
|
||||
|
||||
std::pair<bool, std::string> CLIHandler::version(const std::vector<std::string> &args)
|
||||
std::pair<bool, std::string> CLIHandler::version([[maybe_unused]] const std::vector<std::string> &args)
|
||||
{
|
||||
return {true, get_version_string()};
|
||||
}
|
||||
|
||||
std::pair<bool, std::string> CLIHandler::category_list(const std::vector<std::string> &args)
|
||||
std::pair<bool, std::string> CLIHandler::category_list([[maybe_unused]] const std::vector<std::string> &args)
|
||||
{
|
||||
auto categoryDao = this->db->createCategoryDao();
|
||||
auto categories = categoryDao->fetchList(QueryOption{});
|
||||
|
30
cli.h
30
cli.h
@ -22,20 +22,20 @@ class CLIHandler
|
||||
Config *conf;
|
||||
|
||||
protected:
|
||||
std::pair<bool, std::string> attach(const std::vector<std::string> &args);
|
||||
std::pair<bool, std::string> cli_help(const std::vector<std::string> &args);
|
||||
std::pair<bool, std::string> user_add(const std::vector<std::string> &args);
|
||||
std::pair<bool, std::string> user_change_pw(const std::vector<std::string> &args);
|
||||
std::pair<bool, std::string> user_rename(const std::vector<std::string> &args);
|
||||
std::pair<bool, std::string> user_set_perms(const std::vector<std::string> &args);
|
||||
std::pair<bool, std::string> user_list(const std::vector<std::string> &args);
|
||||
std::pair<bool, std::string> user_show(const std::vector<std::string> &args);
|
||||
std::pair<bool, std::string> page_list(const std::vector<std::string> &args);
|
||||
std::pair<bool, std::string> pageperms_set_permissions(const std::vector<std::string> &args);
|
||||
std::pair<bool, std::string> version(const std::vector<std::string> &args);
|
||||
std::pair<bool, std::string> category_list(const std::vector<std::string> &args);
|
||||
std::pair<bool, std::string> category_delete(const std::vector<std::string> &args);
|
||||
std::pair<bool, std::string> category_show(const std::vector<std::string> &args);
|
||||
std::pair<bool, std::string> attach([[maybe_unused]] const std::vector<std::string> &args);
|
||||
std::pair<bool, std::string> cli_help([[maybe_unused]] const std::vector<std::string> &args);
|
||||
std::pair<bool, std::string> user_add([[maybe_unused]] const std::vector<std::string> &args);
|
||||
std::pair<bool, std::string> user_change_pw([[maybe_unused]] const std::vector<std::string> &args);
|
||||
std::pair<bool, std::string> user_rename([[maybe_unused]] const std::vector<std::string> &args);
|
||||
std::pair<bool, std::string> user_set_perms([[maybe_unused]] const std::vector<std::string> &args);
|
||||
std::pair<bool, std::string> user_list([[maybe_unused]] const std::vector<std::string> &args);
|
||||
std::pair<bool, std::string> user_show([[maybe_unused]] const std::vector<std::string> &args);
|
||||
std::pair<bool, std::string> page_list([[maybe_unused]] const std::vector<std::string> &args);
|
||||
std::pair<bool, std::string> pageperms_set_permissions([[maybe_unused]] const std::vector<std::string> &args);
|
||||
std::pair<bool, std::string> version([[maybe_unused]] const std::vector<std::string> &args);
|
||||
std::pair<bool, std::string> category_list([[maybe_unused]] const std::vector<std::string> &args);
|
||||
std::pair<bool, std::string> category_delete([[maybe_unused]] const std::vector<std::string> &args);
|
||||
std::pair<bool, std::string> category_show([[maybe_unused]] const std::vector<std::string> &args);
|
||||
|
||||
std::vector<struct cmd> cmds{
|
||||
{{"user",
|
||||
@ -73,7 +73,7 @@ class CLIHandler
|
||||
"exit cli",
|
||||
0,
|
||||
{},
|
||||
[](CLIHandler *, const std::vector<std::string> &args) -> std::pair<bool, std::string>
|
||||
[](CLIHandler *, [[maybe_unused]] const std::vector<std::string> &args) -> std::pair<bool, std::string>
|
||||
{
|
||||
exit(EXIT_SUCCESS);
|
||||
return {true, ""};
|
||||
|
@ -116,7 +116,7 @@ std::vector<User> UserDaoSqlite::list(QueryOption o)
|
||||
return result;
|
||||
}
|
||||
|
||||
void UserDaoSqlite::deleteUser(std::string username)
|
||||
void UserDaoSqlite::deleteUser([[maybe_unused]] std::string username)
|
||||
{
|
||||
// What to do with the contributions of the user?
|
||||
}
|
||||
|
@ -36,12 +36,12 @@ class Handler
|
||||
}
|
||||
|
||||
virtual Response handle(const Request &r);
|
||||
virtual Response handleRequest(const Request &r)
|
||||
virtual Response handleRequest([[maybe_unused]] const Request &r)
|
||||
{
|
||||
return this->errorResponse("Invalid action", "This action is not implemented yet");
|
||||
}
|
||||
|
||||
virtual bool canAccess(const Permissions &perms)
|
||||
virtual bool canAccess([[maybe_unused]] const Permissions &perms)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ SOFTWARE.
|
||||
*/
|
||||
#include "handlerdefault.h"
|
||||
|
||||
Response HandlerDefault::handleRequest(const Request &r)
|
||||
Response HandlerDefault::handleRequest([[maybe_unused]] const Request &r)
|
||||
{
|
||||
return Response::redirectTemporarily(this->urlProvider->index());
|
||||
}
|
||||
@ -29,7 +29,7 @@ HandlerDefault::~HandlerDefault()
|
||||
{
|
||||
}
|
||||
|
||||
bool HandlerDefault::canAccess(const Permissions &perms)
|
||||
bool HandlerDefault::canAccess([[maybe_unused]] const Permissions &perms)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -50,7 +50,8 @@ Response HandlerHistory::handleRequest(const Request &r)
|
||||
std::vector<Revision> resultList;
|
||||
auto revisionDao = this->database->createRevisionDao();
|
||||
|
||||
auto makeSortedLink = [&](unsigned int limit, unsigned int offset, unsigned int order) {
|
||||
auto makeSortedLink = [&](unsigned int limit, unsigned int offset, unsigned int order)
|
||||
{
|
||||
if(!page.empty())
|
||||
{
|
||||
return this->urlProvider->pageHistorySort(page, limit, offset, order);
|
||||
@ -122,7 +123,7 @@ Response HandlerHistory::handleRequest(const Request &r)
|
||||
return response;
|
||||
}
|
||||
|
||||
bool HandlerHistory::canAccess(const Permissions &perms)
|
||||
bool HandlerHistory::canAccess([[maybe_unused]] const Permissions &perms)
|
||||
{
|
||||
return true; // This is a lie but we need to this a little more fine grained here, which we do in the handleRequest
|
||||
}
|
||||
|
@ -20,12 +20,12 @@ SOFTWARE.
|
||||
*/
|
||||
#include "handlerinvalidaction.h"
|
||||
|
||||
Response HandlerInvalidAction::handleRequest(const Request &r)
|
||||
Response HandlerInvalidAction::handleRequest([[maybe_unused]] const Request &r)
|
||||
{
|
||||
return errorResponse("Invalid action", "No action defined for this action");
|
||||
}
|
||||
|
||||
bool HandlerInvalidAction::canAccess(const Permissions &perms)
|
||||
bool HandlerInvalidAction::canAccess([[maybe_unused]] const Permissions &perms)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ Response HandlerLogin::handleRequest(const Request &r)
|
||||
return result;
|
||||
}
|
||||
|
||||
bool HandlerLogin::canAccess(const Permissions &perms)
|
||||
bool HandlerLogin::canAccess([[maybe_unused]] const Permissions &perms)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ SOFTWARE.
|
||||
#include "../request.h"
|
||||
|
||||
#include "../parser.h"
|
||||
bool HandlerPageEdit::canAccess(std::string page)
|
||||
bool HandlerPageEdit::canAccess([[maybe_unused]] std::string page)
|
||||
{
|
||||
return this->userSession->user.permissions.canEdit();
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ Response HandlerUserSettings::handleRequest(const Request &r)
|
||||
return result;
|
||||
}
|
||||
|
||||
bool HandlerUserSettings::canAccess(const Permissions &perms)
|
||||
bool HandlerUserSettings::canAccess([[maybe_unused]] const Permissions &perms)
|
||||
{
|
||||
return this->userSession->loggedIn;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "handlerversion.h"
|
||||
#include "../version.h"
|
||||
Response HandlerVersion::handleRequest(const Request &r)
|
||||
Response HandlerVersion::handleRequest([[maybe_unused]] const Request &r)
|
||||
{
|
||||
Response response;
|
||||
response.setContentType("text/plain");
|
||||
|
@ -9,7 +9,7 @@ class HandlerVersion : public Handler
|
||||
public:
|
||||
Response handleRequest(const Request &r) override;
|
||||
|
||||
bool canAccess(const Permissions &perms) override
|
||||
bool canAccess([[maybe_unused]] const Permissions &perms) override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ SOFTWARE.
|
||||
#include "cliserver.h"
|
||||
#include "version.h"
|
||||
|
||||
void sigterm_handler(int arg)
|
||||
void sigterm_handler([[maybe_unused]] int arg)
|
||||
{
|
||||
// TODO: proper shutdown.
|
||||
exit(EXIT_SUCCESS);
|
||||
|
Caricamento…
Fai riferimento in un nuovo problema
Block a user