From 96580e5c40a7540935c6ece8946eb174f43023e3 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 12 Feb 2020 10:28:48 +0100 Subject: [PATCH] [libcalamares] Convenience header for Boost and its warnings --- src/libcalamares/utils/BoostPython.h | 73 ++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 src/libcalamares/utils/BoostPython.h diff --git a/src/libcalamares/utils/BoostPython.h b/src/libcalamares/utils/BoostPython.h new file mode 100644 index 000000000..7bd8865da --- /dev/null +++ b/src/libcalamares/utils/BoostPython.h @@ -0,0 +1,73 @@ +/* === This file is part of Calamares - === + * + * Copyright 2019-2020, Adriaan de Groot + * + * Calamares is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Calamares is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Calamares. If not, see . + */ + +/* + * The Python and Boost::Python headers are not C++14 warning-proof, especially + * with picky compilers like Clang 8 and 9. Since we use Clang for the + * find-all-the-warnings case, switch those warnings off for + * the we-can't-change-them system headers. + * + * This convenience header handles including all the bits we need for + * Python support, while silencing warnings. + */ +#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" + +// Actually for Python headers +#pragma clang diagnostic ignored "-Wreserved-id-macro" +#endif + +#undef slots +#include +#include +#include +#include +#include + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + +#endif