Reduce warnings for yaml-cpp

- Use only utils/YamlUtils.h to pull in yaml-cpp and supporting code.
 - When compiling with clang, turn off warnings that the system header
   for yaml-cpp would generate.
This commit is contained in:
Adriaan de Groot 2019-04-17 11:43:21 +02:00
parent 27140ff5bb
commit c83395ff6d
14 changed files with 21 additions and 31 deletions

View File

@ -27,8 +27,6 @@
#include <QFile> #include <QFile>
#include <QPair> #include <QPair>
#include <yaml-cpp/yaml.h>
static bool static bool
hasValue( const YAML::Node& v ) hasValue( const YAML::Node& v )
{ {

View File

@ -20,8 +20,6 @@
#include "utils/Logger.h" #include "utils/Logger.h"
#include <yaml-cpp/yaml.h>
#include <QByteArray> #include <QByteArray>
#include <QFile> #include <QFile>
#include <QFileInfo> #include <QFileInfo>

View File

@ -26,11 +26,21 @@
class QByteArray; class QByteArray;
class QFileInfo; class QFileInfo;
namespace YAML // The yaml-cpp headers are not C++11 warning-proof, especially
{ // with picky compilers like Clang 8. Since we use Clang for the
class Node; // find-all-the-warnings case, switch those warnings off for
class Exception; // 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"
#endif
#include <yaml-cpp/yaml.h>
#ifdef __clang__
#pragma clang diagnostic pop
#endif
/// @brief Appends all te elements of @p node to the string list @p v /// @brief Appends all te elements of @p node to the string list @p v
void operator>>( const YAML::Node& node, QStringList& v ); void operator>>( const YAML::Node& node, QStringList& v );

View File

@ -32,9 +32,6 @@
#include <QPixmap> #include <QPixmap>
#include <QVariantMap> #include <QVariantMap>
#include <yaml-cpp/yaml.h>
namespace Calamares namespace Calamares
{ {

View File

@ -36,8 +36,6 @@
#include "PythonQtViewModule.h" #include "PythonQtViewModule.h"
#endif #endif
#include <yaml-cpp/yaml.h>
#include <QDir> #include <QDir>
#include <QFile> #include <QFile>
#include <QFileInfo> #include <QFileInfo>

View File

@ -28,8 +28,6 @@
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/YamlUtils.h" #include "utils/YamlUtils.h"
#include <yaml-cpp/yaml.h>
#include <QApplication> #include <QApplication>
#include <QDir> #include <QDir>
#include <QTimer> #include <QTimer>

View File

@ -22,8 +22,6 @@
#include "utils/CommandList.h" #include "utils/CommandList.h"
#include "utils/YamlUtils.h" #include "utils/YamlUtils.h"
#include <yaml-cpp/yaml.h>
#include <QtTest/QtTest> #include <QtTest/QtTest>
#include <QFileInfo> #include <QFileInfo>

View File

@ -25,8 +25,6 @@
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/YamlUtils.h" #include "utils/YamlUtils.h"
#include <yaml-cpp/yaml.h>
#include <QtTest/QtTest> #include <QtTest/QtTest>
#include <QFileInfo> #include <QFileInfo>

View File

@ -25,8 +25,6 @@
#include <QByteArray> #include <QByteArray>
#include <yaml-cpp/yaml.h>
GeoIPJSON::GeoIPJSON(const QString& attribute) GeoIPJSON::GeoIPJSON(const QString& attribute)
: GeoIP( attribute.isEmpty() ? QStringLiteral( "time_zone" ) : attribute ) : GeoIP( attribute.isEmpty() ? QStringLiteral( "time_zone" ) : attribute )
{ {

View File

@ -42,8 +42,6 @@
#include <QNetworkReply> #include <QNetworkReply>
#include <QtConcurrent/QtConcurrentRun> #include <QtConcurrent/QtConcurrentRun>
#include <yaml-cpp/yaml.h>
CALAMARES_PLUGIN_FACTORY_DEFINITION( LocaleViewStepFactory, registerPlugin<LocaleViewStep>(); ) CALAMARES_PLUGIN_FACTORY_DEFINITION( LocaleViewStepFactory, registerPlugin<LocaleViewStep>(); )

View File

@ -36,8 +36,6 @@
#include <QHeaderView> #include <QHeaderView>
#include <yaml-cpp/yaml.h>
using CalamaresUtils::yamlToVariant; using CalamaresUtils::yamlToVariant;
NetInstallPage::NetInstallPage( QWidget* parent ) NetInstallPage::NetInstallPage( QWidget* parent )

View File

@ -27,7 +27,10 @@
#include <QObject> #include <QObject>
#include <QString> #include <QString>
#include <yaml-cpp/yaml.h> namespace YAML
{
class Node;
}
class PackageModel : public QAbstractItemModel class PackageModel : public QAbstractItemModel
{ {

View File

@ -26,8 +26,6 @@
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/YamlUtils.h" #include "utils/YamlUtils.h"
#include <yaml-cpp/yaml.h>
#include <QtTest/QtTest> #include <QtTest/QtTest>
#include <QFileInfo> #include <QFileInfo>

View File

@ -21,13 +21,13 @@
* shipped with each module for correctness -- well, for parseability. * shipped with each module for correctness -- well, for parseability.
*/ */
#include "utils/YamlUtils.h"
#include <unistd.h> #include <unistd.h>
#include <stdlib.h> #include <stdlib.h>
#include <iostream> #include <iostream>
#include <yaml-cpp/yaml.h>
#include <QFile> #include <QFile>
#include <QByteArray> #include <QByteArray>