Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake: Add -Wformat=2 and -Wundef warnings #3876

Merged
merged 1 commit into from
May 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,7 @@ if(MSVC)
target_compile_definitions(mixxx-lib PUBLIC _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING _CRT_SECURE_NO_WARNINGS)
endif()
else()
target_compile_options(mixxx-lib PUBLIC -Wall -Wextra -Woverloaded-virtual -Wfloat-conversion -Werror=return-type)
target_compile_options(mixxx-lib PUBLIC -Wall -Wextra -Woverloaded-virtual -Wfloat-conversion -Werror=return-type -Wformat=2 -Wundef)
if(WARNINGS_PEDANTIC)
target_compile_options(mixxx-lib PUBLIC -pedantic)
endif()
Expand Down
4 changes: 2 additions & 2 deletions src/encoder/encoderfdkaac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ EncoderFdkAac::EncoderFdkAac(EncoderCallback* pCallback)
// implementation of fdk-aac, we believe that the FDK AAC license is
// GPL compatible.
QStringList libnames;
#if __WINDOWS__
#if defined(__WINDOWS__)
// Search for library from B.U.T.T.
QString buttFdkAacPath = buttWindowsFdkAac();
if (!buttFdkAacPath.isEmpty()) {
kLogger.debug() << "Found libfdk-aac at" << buttFdkAacPath;
libnames << buttFdkAacPath;
}
#elif __APPLE__
#elif defined(__APPLE__)
// Homebrew
libnames << QStringLiteral("/usr/local/lib/libfdk-aac");
// MacPorts
Expand Down
4 changes: 2 additions & 2 deletions src/preferences/upgrade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ UserSettingsPointer Upgrade::versionUpgrade(const QString& settingsPath) {
configVersion = config->getValueString(ConfigKey("[Config]","Version"));
}
else {
#elif __WINDOWS__
#elif defined(__WINDOWS__)
qDebug() << "Config version is empty, trying to read pre-1.12.0 config";
// Try to read the config from the pre-1.12.0 final directory on Windows (we moved it in 1.12.0 final)
QScopedPointer<QFile> oldConfigFile(new QFile(QDir::homePath().append("/Local Settings/Application Data/Mixxx/mixxx.cfg")));
Expand All @@ -227,7 +227,7 @@ UserSettingsPointer Upgrade::versionUpgrade(const QString& settingsPath) {
return config;
#ifdef __APPLE__
}
#elif __WINDOWS__
#elif defined(__WINDOWS__)
}
#endif
}
Expand Down
4 changes: 2 additions & 2 deletions src/track/taglib/trackmetadata_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void readAudioProperties(
audio::SampleRate(audioProperties.sampleRate()),
},
audio::Bitrate(audioProperties.bitrate()),
#if (TAGLIB_HAS_LENGTH_IN_MILLISECONDS)
#if defined(TAGLIB_HAS_LENGTH_IN_MILLISECONDS) && (TAGLIB_HAS_LENGTH_IN_MILLISECONDS)
Duration::fromMillis(audioProperties.lengthInMilliseconds()),
#else
Duration::fromSeconds(audioProperties.length()),
Expand Down Expand Up @@ -151,7 +151,7 @@ bool hasMP4Tag(TagLib::MP4::File& file) {
// Note (TagLib 1.11.1): For MP4 files without file tags
// TagLib still reports that the MP4 tag exists. Additionally
// we need to check that the tag itself is not empty.
#if (TAGLIB_HAS_MP4TAG_CHECK_AND_IS_EMPTY)
#if defined(TAGLIB_HAS_MP4TAG_CHECK_AND_IS_EMPTY) && (TAGLIB_HAS_MP4TAG_CHECK_AND_IS_EMPTY)
return file.hasMP4Tag() && !file.tag()->isEmpty();
#else
return file.tag() != nullptr;
Expand Down