From d26fde664745f4b35751f26106d325ac02f08974 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sun, 1 Nov 2020 00:05:05 +0100 Subject: [PATCH] [partition] Reduce warnings - Add a helper header that munges the warnings-settings so that KPMcore headers can be included. --- src/libcalamares/partition/KPMHelper.h | 36 +++++++++++++++++++ .../partition/tests/PartitionJobTests.cpp | 4 +-- 2 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 src/libcalamares/partition/KPMHelper.h diff --git a/src/libcalamares/partition/KPMHelper.h b/src/libcalamares/partition/KPMHelper.h new file mode 100644 index 000000000..900c973a2 --- /dev/null +++ b/src/libcalamares/partition/KPMHelper.h @@ -0,0 +1,36 @@ +/* === This file is part of Calamares - === + * + * SPDX-FileCopyrightText: 2020 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later + * + * Calamares is Free Software: see the License-Identifier above. + * + */ + +/* + * KPMCore header file inclusion. + * + * Includes the system KPMCore headers without warnings (by switching off + * the expected warnings). + */ +#ifndef PARTITION_KPMHELPER_H +#define PARTITION_KPMHELPER_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" +#endif + +#include +#include + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + +#endif diff --git a/src/modules/partition/tests/PartitionJobTests.cpp b/src/modules/partition/tests/PartitionJobTests.cpp index 2b0b1a1dc..204819fef 100644 --- a/src/modules/partition/tests/PartitionJobTests.cpp +++ b/src/modules/partition/tests/PartitionJobTests.cpp @@ -15,14 +15,12 @@ #include "jobs/CreatePartitionTableJob.h" #include "jobs/ResizePartitionJob.h" +#include "partition/KPMHelper.h" #include "partition/KPMManager.h" #include "partition/PartitionQuery.h" #include "utils/Logger.h" #include "utils/Units.h" -#include -#include - #include #include #include