[libcalamares] Use Qt helper macros for compiler warnings

This commit is contained in:
Adriaan de Groot 2024-12-21 10:04:22 +01:00
parent b6b09d0bc2
commit 419bedf661
7 changed files with 54 additions and 80 deletions

View File

@ -26,10 +26,8 @@ namespace CalamaresPython
boost::python::object
variantToPyObject( const QVariant& variant )
{
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wswitch-enum"
#endif
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG( "-Wswitch-enum" )
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
const auto IntVariantType = QVariant::Int;
@ -82,9 +80,7 @@ variantToPyObject( const QVariant& variant )
default:
return bp::object();
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
QT_WARNING_POP
}
QVariant

View File

@ -28,10 +28,8 @@ static const char* s_preScript = nullptr;
namespace bp = boost::python;
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdisabled-macro-expansion"
#endif
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG( "-Wdisabled-macro-expansion" )
BOOST_PYTHON_FUNCTION_OVERLOADS( mount_overloads, CalamaresPython::mount, 2, 4 );
BOOST_PYTHON_FUNCTION_OVERLOADS( target_env_call_str_overloads, CalamaresPython::target_env_call, 1, 3 );
@ -52,9 +50,7 @@ BOOST_PYTHON_FUNCTION_OVERLOADS( target_env_process_output_overloads,
4 );
BOOST_PYTHON_FUNCTION_OVERLOADS( host_env_process_output_overloads, CalamaresPython::host_env_process_output, 1, 4 );
#ifdef __clang__
#pragma clang diagnostic pop
#endif
QT_WARNING_POP
BOOST_PYTHON_MODULE( libcalamares )
{

View File

@ -16,18 +16,18 @@
#ifndef PARTITION_KPMHELPER_H
#define PARTITION_KPMHELPER_H
#include <qglobal.h>
// The kpmcore headers are not C++17 warning-proof, especially
// with picky compilers like Clang 10. Since we use Clang for the
// find-all-the-warnings case, switch those warnings off for
// the we-can't-change-them system headers.
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdocumentation"
#pragma clang diagnostic ignored "-Wsuggest-destructor-override"
#pragma clang diagnostic ignored "-Winconsistent-missing-destructor-override"
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG( "-Wdocumentation" )
QT_WARNING_DISABLE_CLANG( "-Wsuggest-destructor-override" )
QT_WARNING_DISABLE_CLANG( "-Winconsistent-missing-destructor-override" )
// Because of __lastType
#pragma clang diagnostic ignored "-Wreserved-identifier"
#endif
QT_WARNING_DISABLE_CLANG( "-Wreserved-identifier" )
#include <backend/corebackend.h>
#include <core/device.h>
@ -38,8 +38,6 @@
#include <fs/filesystem.h>
#include <fs/filesystemfactory.h>
#ifdef __clang__
#pragma clang diagnostic pop
#endif
QT_WARNING_POP
#endif

View File

@ -43,10 +43,8 @@ Calamares::Python::Dictionary variantHashToPyDict( const QVariantHash& variantHa
py::object
variantToPyObject( const QVariant& variant )
{
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wswitch-enum"
#endif
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG( "-Wswitch-enum" )
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
const auto IntVariantType = QVariant::Int;
@ -99,9 +97,7 @@ variantToPyObject( const QVariant& variant )
default:
return py::none();
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
QT_WARNING_POP
}
Calamares::Python::List

View File

@ -5,7 +5,6 @@
*
* Calamares is Free Software: see the License-Identifier above.
*
*
*/
/*
@ -20,36 +19,34 @@
#ifndef UTILS_BOOSTPYTHON_H
#define UTILS_BOOSTPYTHON_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wreserved-id-macro"
#pragma clang diagnostic ignored "-Wold-style-cast"
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
#pragma clang diagnostic ignored "-Wextra-semi-stmt"
#pragma clang diagnostic ignored "-Wall"
#pragma clang diagnostic ignored "-Wimplicit-float-conversion"
#pragma clang diagnostic ignored "-Wundef"
#pragma clang diagnostic ignored "-Wdeprecated-dynamic-exception-spec"
#pragma clang diagnostic ignored "-Wshadow-field-in-constructor"
#pragma clang diagnostic ignored "-Wshadow"
#pragma clang diagnostic ignored "-Wmissing-noreturn"
#pragma clang diagnostic ignored "-Wcast-qual"
#pragma clang diagnostic ignored "-Wcast-align"
#pragma clang diagnostic ignored "-Wsign-conversion"
#pragma clang diagnostic ignored "-Wdouble-promotion"
#pragma clang diagnostic ignored "-Wredundant-parens"
#pragma clang diagnostic ignored "-Wweak-vtables"
#pragma clang diagnostic ignored "-Wdeprecated"
#pragma clang diagnostic ignored "-Wmissing-field-initializers"
#pragma clang diagnostic ignored "-Wdisabled-macro-expansion"
#pragma clang diagnostic ignored "-Wdocumentation"
#pragma clang diagnostic ignored "-Wcomma"
#pragma clang diagnostic ignored "-Wunused-parameter"
#pragma clang diagnostic ignored "-Wunused-template"
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG( "-Wreserved-id-macro" )
QT_WARNING_DISABLE_CLANG( "-Wold-style-cast" )
QT_WARNING_DISABLE_CLANG( "-Wzero-as-null-pointer-constant" )
QT_WARNING_DISABLE_CLANG( "-Wextra-semi-stmt" )
QT_WARNING_DISABLE_CLANG( "-Wall" )
QT_WARNING_DISABLE_CLANG( "-Wimplicit-float-conversion" )
QT_WARNING_DISABLE_CLANG( "-Wundef" )
QT_WARNING_DISABLE_CLANG( "-Wdeprecated-dynamic-exception-spec" )
QT_WARNING_DISABLE_CLANG( "-Wshadow-field-in-constructor" )
QT_WARNING_DISABLE_CLANG( "-Wshadow" )
QT_WARNING_DISABLE_CLANG( "-Wmissing-noreturn" )
QT_WARNING_DISABLE_CLANG( "-Wcast-qual" )
QT_WARNING_DISABLE_CLANG( "-Wcast-align" )
QT_WARNING_DISABLE_CLANG( "-Wsign-conversion" )
QT_WARNING_DISABLE_CLANG( "-Wdouble-promotion" )
QT_WARNING_DISABLE_CLANG( "-Wredundant-parens" )
QT_WARNING_DISABLE_CLANG( "-Wweak-vtables" )
QT_WARNING_DISABLE_CLANG( "-Wdeprecated" )
QT_WARNING_DISABLE_CLANG( "-Wmissing-field-initializers" )
QT_WARNING_DISABLE_CLANG( "-Wdisabled-macro-expansion" )
QT_WARNING_DISABLE_CLANG( "-Wdocumentation" )
QT_WARNING_DISABLE_CLANG( "-Wcomma" )
QT_WARNING_DISABLE_CLANG( "-Wunused-parameter" )
QT_WARNING_DISABLE_CLANG( "-Wunused-template" )
// Actually for Python headers
#pragma clang diagnostic ignored "-Wreserved-id-macro"
#endif
QT_WARNING_DISABLE_CLANG( "-Wreserved-id-macro" )
#undef slots
#include <boost/python.hpp>
@ -58,8 +55,6 @@
#include <boost/python/list.hpp>
#include <boost/python/object.hpp>
#ifdef __clang__
#pragma clang diagnostic pop
#endif
QT_WARNING_POP
#endif

View File

@ -4,11 +4,8 @@
* SPDX-FileCopyrightText: 2017-2018 Adriaan de Groot <groot@kde.org>
* SPDX-License-Identifier: GPL-3.0-or-later
*
*
* Calamares is Free Software: see the License-Identifier above.
*
*
*
*/
/*
@ -35,19 +32,15 @@ class QFileInfo;
// with picky compilers like Clang 8. Since we use Clang for the
// find-all-the-warnings case, switch those warnings off for
// the we-can't-change-them system headers.
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
#pragma clang diagnostic ignored "-Wshadow"
#pragma clang diagnostic ignored "-Wfloat-equal"
#pragma clang diagnostic ignored "-Wsuggest-destructor-override"
#endif
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG( "-Wzero-as-null-pointer-constant" )
QT_WARNING_DISABLE_CLANG( "-Wshadow" )
QT_WARNING_DISABLE_CLANG( "-Wfloat-equal" )
QT_WARNING_DISABLE_CLANG( "-Wsuggest-destructor-override" )
#include <yaml-cpp/yaml.h>
#ifdef __clang__
#pragma clang diagnostic pop
#endif
QT_WARNING_POP
/// @brief Appends all the elements of @p node to the string list @p v
DLLEXPORT void operator>>( const ::YAML::Node& node, QStringList& v );

View File

@ -22,11 +22,11 @@
* automoc does all the work for us.
*/
#ifdef __clang__
#pragma clang diagnostic ignored "-Wextra-semi-stmt"
#pragma clang diagnostic ignored "-Wredundant-parens"
#pragma clang diagnostic ignored "-Wreserved-identifier"
QT_WARNING_DISABLE_CLANG( "-Wextra-semi-stmt" )
QT_WARNING_DISABLE_CLANG( "-Wredundant-parens" )
QT_WARNING_DISABLE_CLANG( "-Wreserved-identifier" )
#if __clang_major__ >= 17
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
QT_WARNING_DISABLE_CLANG( "-Wunsafe-buffer-usage" )
#endif
#endif