NOISSUE fix all sorts of warnings, enable Werror and pedantic

This commit is contained in:
Petr Mrázek 2018-06-28 23:18:45 +02:00
parent b5f636b3d5
commit 7fe94ca7b4
21 changed files with 55 additions and 49 deletions

View File

@ -32,7 +32,7 @@ set(CMAKE_C_STANDARD_REQUIRED true)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_C_STANDARD 11)
include(GenerateExportHeader)
set(CMAKE_CXX_FLAGS " -Wall -D_GLIBCXX_USE_CXX11_ABI=0 ${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS " -Wall -pedantic -Werror -D_GLIBCXX_USE_CXX11_ABI=0 ${CMAKE_CXX_FLAGS}")
if(UNIX AND APPLE)
set(CMAKE_CXX_FLAGS " -stdlib=libc++ ${CMAKE_CXX_FLAGS}")
endif()

View File

@ -34,4 +34,4 @@ namespace DesktopServices
* Open the URL, most likely in a browser. Maybe.
*/
MULTIMC_GUI_EXPORT bool openUrl(const QUrl &url);
};
}

View File

@ -7,8 +7,9 @@
class QUrl;
struct MULTIMC_LOGIC_EXPORT Version
class MULTIMC_LOGIC_EXPORT Version
{
public:
Version(const QString &str);
Version() {}

View File

@ -80,4 +80,4 @@ void serializeRequires(QJsonObject & objOut, RequireSet* ptr, const char * keyNa
MetadataVersion currentFormatVersion();
}
Q_DECLARE_METATYPE(std::set<Meta::Require>);
Q_DECLARE_METATYPE(std::set<Meta::Require>)

View File

@ -145,7 +145,7 @@ QDateTime Component::getReleaseDateTime()
bool Component::isEnabled()
{
return !canBeDisabled() || !m_disabled;
};
}
bool Component::canBeDisabled()
{
@ -171,7 +171,7 @@ bool Component::setEnabled(bool state)
bool Component::isCustom()
{
return m_file != nullptr;
};
}
bool Component::isCustomizable()
{

View File

@ -59,7 +59,7 @@ QList< std::shared_ptr< NetAction > > Library::getDownloads(OpSys system, class
bool local = isLocal();
bool isForge = (hint() == "forge-pack-xz");
auto add_download = [&](QString storage, QString url, QString sha1 = QString())
auto add_download = [&](QString storage, QString url, QString sha1)
{
auto entry = cache->resolveEntry("libraries", storage);
if(isAlwaysStale)
@ -208,14 +208,14 @@ QList< std::shared_ptr< NetAction > > Library::getDownloads(OpSys system, class
{
QString cooked_storage = raw_storage;
QString cooked_dl = raw_dl;
add_download(cooked_storage.replace("${arch}", "32"), cooked_dl.replace("${arch}", "32"));
add_download(cooked_storage.replace("${arch}", "32"), cooked_dl.replace("${arch}", "32"), QString());
cooked_storage = raw_storage;
cooked_dl = raw_dl;
add_download(cooked_storage.replace("${arch}", "64"), cooked_dl.replace("${arch}", "64"));
add_download(cooked_storage.replace("${arch}", "64"), cooked_dl.replace("${arch}", "64"), QString());
}
else
{
add_download(raw_storage, raw_dl);
add_download(raw_storage, raw_dl, QString());
}
}
return out;

View File

@ -18,7 +18,7 @@ public:
MinecraftInstance(SettingsObjectPtr globalSettings, SettingsObjectPtr settings, const QString &rootDir);
virtual ~MinecraftInstance() {};
virtual void init() override;
virtual void saveNow();
virtual void saveNow() override;
// FIXME: remove
QString typeName() const override;

View File

@ -275,7 +275,7 @@ static QString read_string (nbt::value& parent, const char * name, const QString
qWarning() << "NBT tag" << name << "could not be converted to string. Defaulting to" << fallback;
return fallback;
}
};
}
static int64_t read_long (nbt::value& parent, const char * name, const int64_t & fallback = 0)
{
@ -301,7 +301,7 @@ static int64_t read_long (nbt::value& parent, const char * name, const int64_t &
qWarning() << "NBT tag" << name << "could not be converted to long. Defaulting to" << fallback;
return fallback;
}
};
}
void World::loadFromLevelDat(QByteArray data)
{

View File

@ -25,8 +25,8 @@ public:
explicit ModMinecraftJar(LaunchTask *parent) : LaunchStep(parent) {};
virtual ~ModMinecraftJar(){};
virtual void executeTask();
virtual bool canAbort() const
virtual void executeTask() override;
virtual bool canAbort() const override
{
return false;
}

View File

@ -57,7 +57,7 @@ void FtbPackInstallTask::onDownloadProgress(qint64 current, qint64 total)
{
abortable = true;
progress(current, total * 4);
setStatus(tr("Downloading zip for %1 (%2\%)").arg(m_pack.name).arg(current / 10));
setStatus(tr("Downloading zip for %1 (%2%)").arg(m_pack.name).arg(current / 10));
}
void FtbPackInstallTask::unzip()

View File

@ -10,12 +10,12 @@ FileSink::FileSink(QString filename)
:m_filename(filename)
{
// nil
};
}
FileSink::~FileSink()
{
// nil
};
}
JobStatus FileSink::init(QNetworkRequest& request)
{

View File

@ -10,12 +10,12 @@ MetaCacheSink::MetaCacheSink(MetaEntryPtr entry, ChecksumValidator * md5sum)
:Net::FileSink(entry->getFullPath()), m_entry(entry), m_md5Node(md5sum)
{
addValidator(md5sum);
};
}
MetaCacheSink::~MetaCacheSink()
{
// nil
};
}
JobStatus MetaCacheSink::initCache(QNetworkRequest& request)
{

View File

@ -133,4 +133,4 @@ bool MULTIMC_LOGIC_EXPORT processFileLists
bool MULTIMC_LOGIC_EXPORT fixPathForOSX(QString &path);
}
Q_DECLARE_METATYPE(GoUpdate::Status);
Q_DECLARE_METATYPE(GoUpdate::Status)

View File

@ -227,7 +227,7 @@ QVariant VersionProxyModel::data(const QModelIndex &index, int role) const
return QVariant();
}
}
};
}
QModelIndex VersionProxyModel::parent(const QModelIndex &child) const
{

View File

@ -34,6 +34,7 @@ public:
: m_dialogTitle(dialogTitle)
{
}
virtual ~GenericPageProvider() {}
QList<BasePage *> getPages() override
{

View File

@ -8,7 +8,7 @@ class QCheckBox;
class AnalyticsWizardPage : public BaseWizardPage
{
Q_OBJECT;
Q_OBJECT
public:
explicit AnalyticsWizardPage(QWidget *parent = Q_NULLPTR);
virtual ~AnalyticsWizardPage();

View File

@ -6,7 +6,7 @@ class JavaSettingsWidget;
class JavaWizardPage : public BaseWizardPage
{
Q_OBJECT;
Q_OBJECT
public:
explicit JavaWizardPage(QWidget *parent = Q_NULLPTR);

View File

@ -7,7 +7,7 @@ class QListView;
class LanguageWizardPage : public BaseWizardPage
{
Q_OBJECT;
Q_OBJECT
public:
explicit LanguageWizardPage(QWidget *parent = Q_NULLPTR);

View File

@ -123,16 +123,7 @@ public:
return ss.str();
}
std::string str_data; /** String data in 'modified utf-8'.*/
// store everything here.
union
{
int32_t int_data;
int64_t long_data;
float float_data;
double double_data;
uint16_t index;
struct
struct ref_type_t
{
/**
* Class reference:
@ -143,12 +134,25 @@ public:
uint16_t class_idx;
// used for j_fieldref, j_methodref and j_interface_methodref
uint16_t name_and_type_idx;
} ref_type;
struct
};
struct name_and_type_t
{
uint16_t name_index;
uint16_t descriptor_index;
} name_and_type;
};
std::string str_data; /** String data in 'modified utf-8'.*/
// store everything here.
union
{
int32_t int_data;
int64_t long_data;
float float_data;
double double_data;
uint16_t index;
ref_type_t ref_type;
name_and_type_t name_and_type;
};
};

View File

@ -44,33 +44,33 @@ inline uint64_t bigswap(uint64_t x)
((x << 8) & 0x000000FF00000000) | ((x >> 8) & 0x00000000FF000000) |
((x >> 24) & 0x0000000000FF0000) | ((x >> 40) & 0x000000000000FF00) | (x << 56);
}
;
inline uint32_t bigswap(uint32_t x)
{
return (x >> 24) | ((x << 8) & 0x00FF0000) | ((x >> 8) & 0x0000FF00) | (x << 24);
}
;
inline uint16_t bigswap(uint16_t x)
{
return (x >> 8) | (x << 8);
}
;
inline int64_t bigswap(int64_t x)
{
return (x >> 56) | ((x << 40) & 0x00FF000000000000) | ((x << 24) & 0x0000FF0000000000) |
((x << 8) & 0x000000FF00000000) | ((x >> 8) & 0x00000000FF000000) |
((x >> 24) & 0x0000000000FF0000) | ((x >> 40) & 0x000000000000FF00) | (x << 56);
}
;
inline int32_t bigswap(int32_t x)
{
return (x >> 24) | ((x << 8) & 0x00FF0000) | ((x >> 8) & 0x0000FF00) | (x << 24);
}
;
inline int16_t bigswap(int16_t x)
{
return (x >> 8) | (x << 8);
}
;
#endif
}

View File

@ -52,7 +52,7 @@ struct QtIconCache : public IconCache
}
};
}
Q_GLOBAL_STATIC(IconCache, qtIconCache);
Q_GLOBAL_STATIC(IconCache, qtIconCache)
static void qt_cleanup_icon_cache()
{