Skip to content

Commit

Permalink
gcc: fix warning suppression blocks
Browse files Browse the repository at this point in the history
GCC doesn't support `#pragma clang` directives.
  • Loading branch information
mathstuf committed Oct 31, 2018
1 parent b246287 commit c6f02ce
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
9 changes: 7 additions & 2 deletions test/unit/header_test.cpp
Expand Up @@ -119,16 +119,21 @@ namespace tut
# pragma warning(disable: 4309) // conditional expression is constant.
#endif

#ifndef _MSC_VER
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wconstant-conversion"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Woverflow"
#endif
// Unsigned overflow
// Likely compiler warning: truncation from int to boost::uint16_t
h1.SetFileSourceId(id2 + 1);
ensure_equals(h1.GetFileSourceId(), overflowed);
#ifndef _MSC_VER
#ifdef __clang__
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif

#ifdef _MSC_VER
Expand Down
9 changes: 7 additions & 2 deletions test/unit/tut/tut_assert.hpp
Expand Up @@ -15,9 +15,12 @@

#include "tut_exception.hpp"

#ifndef _MSC_VER
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-function"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
#endif

namespace tut
Expand Down Expand Up @@ -307,8 +310,10 @@ void skip(const M& msg)

}

#ifndef _MSC_VER
#ifdef __clang__
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif

#endif
Expand Down

0 comments on commit c6f02ce

Please sign in to comment.