Added guards for unknown pragmas

Removed push/pop if there was no change to the warnings *in the same
file* for a given compiler. This assumes the imported boost headers use
a warning stack themselves.

The pragmas don't seem to be required anymore, but were not removed to
mantain compatibility with older versions of the boost library.

Compiled with
- clang version 6.0.1 (tags/RELEASE_601/final)
- gcc (GCC) 8.1.1 20180531
 against:
- libboost 1.67.0-5
This commit is contained in:
Augusto F. Hack 2018-07-21 19:08:47 -03:00
parent 20c65f9af1
commit 6c3b48ddfc
4 changed files with 21 additions and 18 deletions

View File

@ -36,13 +36,6 @@ if (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MA
add_compile_options(-Wextra)
add_compile_options(-Werror)
# Disable warnings about unknown pragmas (which is enabled by -Wall). I assume we have external
# dependencies (probably Boost) which have some of these. Whatever the case, we shouldn't be
# disabling these globally. Instead, we should pragma around just the problem #includes.
#
# TODO - Track down what breaks if we do NOT do this.
add_compile_options(-Wno-unknown-pragmas)
# Configuration-specific compiler settings.
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -DETH_DEBUG")
set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG")

View File

@ -40,7 +40,6 @@
#include <libdevcore/vector_ref.h>
#if defined(__GNUC__)
#pragma warning(push)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif // defined(__GNUC__)
@ -57,7 +56,6 @@
#include <boost/multiprecision/cpp_int.hpp>
#if defined(__GNUC__)
#pragma warning(pop)
#pragma GCC diagnostic pop
#endif // defined(__GNUC__)

View File

@ -29,12 +29,18 @@
#include <tuple>
#include <memory>
#include <ostream>
#pragma warning(push)
#pragma GCC diagnostic push
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wredeclared-class-member"
#endif // defined(__clang__)
#include <boost/bimap.hpp>
#pragma warning(pop)
#pragma GCC diagnostic pop
#if defined(__clang__)
#pragma clang diagnostic pop
#endif // defined(__clang__)
#include <libdevcore/CommonIO.h>
#include <libdevcore/Exceptions.h>
#include <libevmasm/ExpressionClasses.h>

View File

@ -22,12 +22,18 @@
#include "CodeFragment.h"
#include <boost/algorithm/string.hpp>
#pragma warning(push)
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif // defined(__GNUC__)
#include <boost/spirit/include/support_utree.hpp>
#pragma warning(pop)
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif // defined(__GNUC__)
#include <libdevcore/CommonIO.h>
#include <libevmasm/Instruction.h>
#include "CompilerState.h"