mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-11-04 14:09:33 +01:00 
			
		
		
		
	Add GCC compiler flag. (see #2094)
This commit is contained in:
		@@ -14,13 +14,14 @@
 | 
				
			|||||||
#   include <atomic> // atomic_thread_fence
 | 
					#   include <atomic> // atomic_thread_fence
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <catch2/internal/catch_compiler_capabilities.hpp>
 | 
				
			||||||
#include <catch2/internal/catch_move_and_forward.hpp>
 | 
					#include <catch2/internal/catch_move_and_forward.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <type_traits>
 | 
					#include <type_traits>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace Catch {
 | 
					namespace Catch {
 | 
				
			||||||
    namespace Benchmark {
 | 
					    namespace Benchmark {
 | 
				
			||||||
#if defined(__GNUC__) || defined(__clang__)
 | 
					#if defined(CATCH_COMPILER_GCC) || defined(__clang__)
 | 
				
			||||||
        template <typename T>
 | 
					        template <typename T>
 | 
				
			||||||
        inline void keep_memory(T* p) {
 | 
					        inline void keep_memory(T* p) {
 | 
				
			||||||
            asm volatile("" : : "g"(p) : "memory");
 | 
					            asm volatile("" : : "g"(p) : "memory");
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,11 +8,13 @@
 | 
				
			|||||||
#ifndef CATCH_TEMPLATE_TEST_MACROS_HPP_INCLUDED
 | 
					#ifndef CATCH_TEMPLATE_TEST_MACROS_HPP_INCLUDED
 | 
				
			||||||
#define CATCH_TEMPLATE_TEST_MACROS_HPP_INCLUDED
 | 
					#define CATCH_TEMPLATE_TEST_MACROS_HPP_INCLUDED
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <catch2/internal/catch_compiler_capabilities.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// We need this suppression to leak, because it took until GCC 10
 | 
					// We need this suppression to leak, because it took until GCC 10
 | 
				
			||||||
// for the front end to handle local suppression via _Pragma properly
 | 
					// for the front end to handle local suppression via _Pragma properly
 | 
				
			||||||
// inside templates (so `TEMPLATE_TEST_CASE` and co).
 | 
					// inside templates (so `TEMPLATE_TEST_CASE` and co).
 | 
				
			||||||
// **THIS IS DIFFERENT FOR STANDARD TESTS, WHERE GCC 9 IS SUFFICIENT**
 | 
					// **THIS IS DIFFERENT FOR STANDARD TESTS, WHERE GCC 9 IS SUFFICIENT**
 | 
				
			||||||
#if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC) && __GNUC__ < 10
 | 
					#if defined(CATCH_COMPILER_GCC) && __GNUC__ < 10
 | 
				
			||||||
#pragma GCC diagnostic ignored "-Wparentheses"
 | 
					#pragma GCC diagnostic ignored "-Wparentheses"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -15,7 +15,7 @@
 | 
				
			|||||||
#    pragma clang diagnostic ignored "-Wdeprecated"
 | 
					#    pragma clang diagnostic ignored "-Wdeprecated"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined( __GNUC__ )
 | 
					#if defined( CATCH_COMPILER_GCC )
 | 
				
			||||||
#    pragma GCC diagnostic push
 | 
					#    pragma GCC diagnostic push
 | 
				
			||||||
#    pragma GCC diagnostic ignored "-Wsign-conversion"
 | 
					#    pragma GCC diagnostic ignored "-Wsign-conversion"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
@@ -702,7 +702,7 @@ namespace Catch {
 | 
				
			|||||||
#    pragma clang diagnostic pop
 | 
					#    pragma clang diagnostic pop
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined( __GNUC__ )
 | 
					#if defined( CATCH_COMPILER_GCC )
 | 
				
			||||||
#    pragma GCC diagnostic pop
 | 
					#    pragma GCC diagnostic pop
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,6 +27,10 @@
 | 
				
			|||||||
#include <catch2/internal/catch_platform.hpp>
 | 
					#include <catch2/internal/catch_platform.hpp>
 | 
				
			||||||
#include <catch2/catch_user_config.hpp>
 | 
					#include <catch2/catch_user_config.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC) && !defined(__CUDACC__) && !defined(__LCC__)
 | 
				
			||||||
 | 
					#define CATCH_COMPILER_GCC
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#  if (__cplusplus >= 201402L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L)
 | 
					#  if (__cplusplus >= 201402L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L)
 | 
				
			||||||
@@ -41,7 +45,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// Only GCC compiler should be used in this block, so other compilers trying to
 | 
					// Only GCC compiler should be used in this block, so other compilers trying to
 | 
				
			||||||
// mask themselves as GCC should be ignored.
 | 
					// mask themselves as GCC should be ignored.
 | 
				
			||||||
#if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC) && !defined(__CUDACC__) && !defined(__LCC__)
 | 
					#if defined(CATCH_COMPILER_GCC)
 | 
				
			||||||
#    define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic push" )
 | 
					#    define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic push" )
 | 
				
			||||||
#    define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION  _Pragma( "GCC diagnostic pop" )
 | 
					#    define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION  _Pragma( "GCC diagnostic pop" )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,6 +8,7 @@
 | 
				
			|||||||
#ifndef CATCH_DEBUGGER_HPP_INCLUDED
 | 
					#ifndef CATCH_DEBUGGER_HPP_INCLUDED
 | 
				
			||||||
#define CATCH_DEBUGGER_HPP_INCLUDED
 | 
					#define CATCH_DEBUGGER_HPP_INCLUDED
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <catch2/internal/catch_compiler_capabilities.hpp>
 | 
				
			||||||
#include <catch2/internal/catch_platform.hpp>
 | 
					#include <catch2/internal/catch_platform.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace Catch {
 | 
					namespace Catch {
 | 
				
			||||||
@@ -39,7 +40,7 @@ namespace Catch {
 | 
				
			|||||||
    // If we can use inline assembler, do it because this allows us to break
 | 
					    // If we can use inline assembler, do it because this allows us to break
 | 
				
			||||||
    // directly at the location of the failing check instead of breaking inside
 | 
					    // directly at the location of the failing check instead of breaking inside
 | 
				
			||||||
    // raise() called from it, i.e. one stack frame below.
 | 
					    // raise() called from it, i.e. one stack frame below.
 | 
				
			||||||
    #if defined(__GNUC__) && (defined(__i386) || defined(__x86_64))
 | 
					    #if defined(CATCH_COMPILER_GCC) && (defined(__i386) || defined(__x86_64))
 | 
				
			||||||
        #define CATCH_TRAP() asm volatile ("int $3") /* NOLINT */
 | 
					        #define CATCH_TRAP() asm volatile ("int $3") /* NOLINT */
 | 
				
			||||||
    #else // Fall back to the generic way.
 | 
					    #else // Fall back to the generic way.
 | 
				
			||||||
        #include <signal.h>
 | 
					        #include <signal.h>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -26,7 +26,7 @@
 | 
				
			|||||||
#ifdef __clang__
 | 
					#ifdef __clang__
 | 
				
			||||||
#  pragma clang diagnostic push
 | 
					#  pragma clang diagnostic push
 | 
				
			||||||
#  pragma clang diagnostic ignored "-Wsign-compare"
 | 
					#  pragma clang diagnostic ignored "-Wsign-compare"
 | 
				
			||||||
#elif defined __GNUC__
 | 
					#elif defined CATCH_COMPILER_GCC
 | 
				
			||||||
#  pragma GCC diagnostic push
 | 
					#  pragma GCC diagnostic push
 | 
				
			||||||
#  pragma GCC diagnostic ignored "-Wsign-compare"
 | 
					#  pragma GCC diagnostic ignored "-Wsign-compare"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
@@ -261,7 +261,7 @@ namespace Catch {
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
#ifdef __clang__
 | 
					#ifdef __clang__
 | 
				
			||||||
#  pragma clang diagnostic pop
 | 
					#  pragma clang diagnostic pop
 | 
				
			||||||
#elif defined __GNUC__
 | 
					#elif defined CATCH_COMPILER_GCC
 | 
				
			||||||
#  pragma GCC diagnostic pop
 | 
					#  pragma GCC diagnostic pop
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -26,6 +26,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include <catch2/internal/catch_fatal_condition_handler.hpp>
 | 
					#include <catch2/internal/catch_fatal_condition_handler.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <catch2/internal/catch_compiler_capabilities.hpp>
 | 
				
			||||||
#include <catch2/internal/catch_context.hpp>
 | 
					#include <catch2/internal/catch_context.hpp>
 | 
				
			||||||
#include <catch2/internal/catch_enforce.hpp>
 | 
					#include <catch2/internal/catch_enforce.hpp>
 | 
				
			||||||
#include <catch2/interfaces/catch_interfaces_capture.hpp>
 | 
					#include <catch2/interfaces/catch_interfaces_capture.hpp>
 | 
				
			||||||
@@ -160,7 +161,7 @@ namespace Catch {
 | 
				
			|||||||
// Older GCCs trigger -Wmissing-field-initializers for T foo = {}
 | 
					// Older GCCs trigger -Wmissing-field-initializers for T foo = {}
 | 
				
			||||||
// which is zero initialization, but not explicit. We want to avoid
 | 
					// which is zero initialization, but not explicit. We want to avoid
 | 
				
			||||||
// that.
 | 
					// that.
 | 
				
			||||||
#if defined(__GNUC__)
 | 
					#if defined(CATCH_COMPILER_GCC)
 | 
				
			||||||
#    pragma GCC diagnostic push
 | 
					#    pragma GCC diagnostic push
 | 
				
			||||||
#    pragma GCC diagnostic ignored "-Wmissing-field-initializers"
 | 
					#    pragma GCC diagnostic ignored "-Wmissing-field-initializers"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
@@ -228,7 +229,7 @@ namespace Catch {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(__GNUC__)
 | 
					#if defined(CATCH_COMPILER_GCC)
 | 
				
			||||||
#    pragma GCC diagnostic pop
 | 
					#    pragma GCC diagnostic pop
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,8 +8,9 @@
 | 
				
			|||||||
#ifndef CATCH_PREPROCESSOR_HPP_INCLUDED
 | 
					#ifndef CATCH_PREPROCESSOR_HPP_INCLUDED
 | 
				
			||||||
#define CATCH_PREPROCESSOR_HPP_INCLUDED
 | 
					#define CATCH_PREPROCESSOR_HPP_INCLUDED
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <catch2/internal/catch_compiler_capabilities.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(__GNUC__)
 | 
					#if defined(CATCH_COMPILER_GCC)
 | 
				
			||||||
// We need to silence "empty __VA_ARGS__ warning", and using just _Pragma does not work
 | 
					// We need to silence "empty __VA_ARGS__ warning", and using just _Pragma does not work
 | 
				
			||||||
#pragma GCC system_header
 | 
					#pragma GCC system_header
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,7 +22,7 @@ namespace Catch {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ) {
 | 
					    std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ) {
 | 
				
			||||||
#ifndef __GNUG__
 | 
					#if !defined(CATCH_COMPILER_GCC) || !defined(__cplusplus)
 | 
				
			||||||
        os << info.file << '(' << info.line << ')';
 | 
					        os << info.file << '(' << info.line << ')';
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
        os << info.file << ':' << info.line;
 | 
					        os << info.file << ':' << info.line;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,6 +8,7 @@
 | 
				
			|||||||
#ifndef CATCH_STREAM_HPP_INCLUDED
 | 
					#ifndef CATCH_STREAM_HPP_INCLUDED
 | 
				
			||||||
#define CATCH_STREAM_HPP_INCLUDED
 | 
					#define CATCH_STREAM_HPP_INCLUDED
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <catch2/internal/catch_compiler_capabilities.hpp>
 | 
				
			||||||
#include <catch2/internal/catch_noncopyable.hpp>
 | 
					#include <catch2/internal/catch_noncopyable.hpp>
 | 
				
			||||||
#include <catch2/internal/catch_unique_ptr.hpp>
 | 
					#include <catch2/internal/catch_unique_ptr.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -65,7 +66,7 @@ namespace Catch {
 | 
				
			|||||||
        //! Sets internal state to `str`
 | 
					        //! Sets internal state to `str`
 | 
				
			||||||
        void str(std::string const& str);
 | 
					        void str(std::string const& str);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(__GNUC__) && !defined(__clang__)
 | 
					#if defined(CATCH_COMPILER_GCC)
 | 
				
			||||||
#pragma GCC diagnostic push
 | 
					#pragma GCC diagnostic push
 | 
				
			||||||
// Old versions of GCC do not understand -Wnonnull-compare
 | 
					// Old versions of GCC do not understand -Wnonnull-compare
 | 
				
			||||||
#pragma GCC diagnostic ignored "-Wpragmas"
 | 
					#pragma GCC diagnostic ignored "-Wpragmas"
 | 
				
			||||||
@@ -83,7 +84,7 @@ namespace Catch {
 | 
				
			|||||||
            return *this;
 | 
					            return *this;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(__GNUC__) && !defined(__clang__)
 | 
					#if defined(CATCH_COMPILER_GCC)
 | 
				
			||||||
#pragma GCC diagnostic pop
 | 
					#pragma GCC diagnostic pop
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
        auto get() -> std::ostream& { return *m_oss; }
 | 
					        auto get() -> std::ostream& { return *m_oss; }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,7 +18,7 @@
 | 
				
			|||||||
// GCC 5 and older do not properly handle disabling unused-variable warning
 | 
					// GCC 5 and older do not properly handle disabling unused-variable warning
 | 
				
			||||||
// with a _Pragma. This means that we have to leak the suppression to the
 | 
					// with a _Pragma. This means that we have to leak the suppression to the
 | 
				
			||||||
// user code as well :-(
 | 
					// user code as well :-(
 | 
				
			||||||
#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ <= 5
 | 
					#if defined(CATCH_COMPILER_GCC) && __GNUC__ <= 5
 | 
				
			||||||
#pragma GCC diagnostic ignored "-Wunused-variable"
 | 
					#pragma GCC diagnostic ignored "-Wunused-variable"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,13 +10,14 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include <catch2/catch_user_config.hpp>
 | 
					#include <catch2/catch_user_config.hpp>
 | 
				
			||||||
#include <catch2/internal/catch_assertion_handler.hpp>
 | 
					#include <catch2/internal/catch_assertion_handler.hpp>
 | 
				
			||||||
 | 
					#include <catch2/internal/catch_compiler_capabilities.hpp>
 | 
				
			||||||
#include <catch2/interfaces/catch_interfaces_capture.hpp>
 | 
					#include <catch2/interfaces/catch_interfaces_capture.hpp>
 | 
				
			||||||
#include <catch2/internal/catch_stringref.hpp>
 | 
					#include <catch2/internal/catch_stringref.hpp>
 | 
				
			||||||
#include <catch2/internal/catch_source_line_info.hpp>
 | 
					#include <catch2/internal/catch_source_line_info.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// We need this suppression to leak, because it took until GCC 9
 | 
					// We need this suppression to leak, because it took until GCC 9
 | 
				
			||||||
// for the front end to handle local suppression via _Pragma properly
 | 
					// for the front end to handle local suppression via _Pragma properly
 | 
				
			||||||
#if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC) && __GNUC__ < 9
 | 
					#if defined(CATCH_COMPILER_GCC) && __GNUC__ < 9
 | 
				
			||||||
  #pragma GCC diagnostic ignored "-Wparentheses"
 | 
					  #pragma GCC diagnostic ignored "-Wparentheses"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,6 +8,7 @@
 | 
				
			|||||||
#ifndef CATCH_TEST_REGISTRY_HPP_INCLUDED
 | 
					#ifndef CATCH_TEST_REGISTRY_HPP_INCLUDED
 | 
				
			||||||
#define CATCH_TEST_REGISTRY_HPP_INCLUDED
 | 
					#define CATCH_TEST_REGISTRY_HPP_INCLUDED
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <catch2/internal/catch_compiler_capabilities.hpp>
 | 
				
			||||||
#include <catch2/internal/catch_source_line_info.hpp>
 | 
					#include <catch2/internal/catch_source_line_info.hpp>
 | 
				
			||||||
#include <catch2/internal/catch_noncopyable.hpp>
 | 
					#include <catch2/internal/catch_noncopyable.hpp>
 | 
				
			||||||
#include <catch2/interfaces/catch_interfaces_testcase.hpp>
 | 
					#include <catch2/interfaces/catch_interfaces_testcase.hpp>
 | 
				
			||||||
@@ -18,7 +19,7 @@
 | 
				
			|||||||
// GCC 5 and older do not properly handle disabling unused-variable warning
 | 
					// GCC 5 and older do not properly handle disabling unused-variable warning
 | 
				
			||||||
// with a _Pragma. This means that we have to leak the suppression to the
 | 
					// with a _Pragma. This means that we have to leak the suppression to the
 | 
				
			||||||
// user code as well :-(
 | 
					// user code as well :-(
 | 
				
			||||||
#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ <= 5
 | 
					#if defined(CATCH_COMPILER_GCC) && __GNUC__ <= 5
 | 
				
			||||||
#pragma GCC diagnostic ignored "-Wunused-variable"
 | 
					#pragma GCC diagnostic ignored "-Wunused-variable"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,6 +12,8 @@
 | 
				
			|||||||
// in a different namespace.
 | 
					// in a different namespace.
 | 
				
			||||||
#include <ostream>
 | 
					#include <ostream>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <catch2/internal/catch_compiler_capabilities.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace foo {
 | 
					namespace foo {
 | 
				
			||||||
    struct helper_1403 {
 | 
					    struct helper_1403 {
 | 
				
			||||||
        bool operator==(helper_1403) const { return true; }
 | 
					        bool operator==(helper_1403) const { return true; }
 | 
				
			||||||
@@ -23,7 +25,7 @@ namespace bar {
 | 
				
			|||||||
    struct TypeList {};
 | 
					    struct TypeList {};
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __GNUC__
 | 
					#ifdef CATCH_COMPILER_GCC
 | 
				
			||||||
#pragma GCC diagnostic ignored "-Wmissing-declarations"
 | 
					#pragma GCC diagnostic ignored "-Wmissing-declarations"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
std::ostream& operator<<(std::ostream& out, foo::helper_1403 const&) {
 | 
					std::ostream& operator<<(std::ostream& out, foo::helper_1403 const&) {
 | 
				
			||||||
@@ -79,7 +81,7 @@ struct B : private A {
 | 
				
			|||||||
#pragma clang diagnostic push
 | 
					#pragma clang diagnostic push
 | 
				
			||||||
#pragma clang diagnostic ignored "-Wunused-function"
 | 
					#pragma clang diagnostic ignored "-Wunused-function"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#ifdef __GNUC__
 | 
					#ifdef CATCH_COMPILER_GCC
 | 
				
			||||||
// Note that because -~GCC~-, this warning cannot be silenced temporarily, by pushing diagnostic stack...
 | 
					// Note that because -~GCC~-, this warning cannot be silenced temporarily, by pushing diagnostic stack...
 | 
				
			||||||
// Luckily it is firing in test files and thus can be silenced for the whole file, without losing much.
 | 
					// Luckily it is firing in test files and thus can be silenced for the whole file, without losing much.
 | 
				
			||||||
#pragma GCC diagnostic ignored "-Wunused-function"
 | 
					#pragma GCC diagnostic ignored "-Wunused-function"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -223,7 +223,7 @@ TEST_CASE( "Comparisons with int literals don't warn when mixing signed/ unsigne
 | 
				
			|||||||
// Disable warnings about sign conversions for the next two tests
 | 
					// Disable warnings about sign conversions for the next two tests
 | 
				
			||||||
// (as we are deliberately invoking them)
 | 
					// (as we are deliberately invoking them)
 | 
				
			||||||
// - Currently only disabled for GCC/ LLVM. Should add VC++ too
 | 
					// - Currently only disabled for GCC/ LLVM. Should add VC++ too
 | 
				
			||||||
#ifdef  __GNUC__
 | 
					#ifdef  CATCH_COMPILER_GCC
 | 
				
			||||||
#pragma GCC diagnostic push
 | 
					#pragma GCC diagnostic push
 | 
				
			||||||
#pragma GCC diagnostic ignored "-Wsign-compare"
 | 
					#pragma GCC diagnostic ignored "-Wsign-compare"
 | 
				
			||||||
#pragma GCC diagnostic ignored "-Wsign-conversion"
 | 
					#pragma GCC diagnostic ignored "-Wsign-conversion"
 | 
				
			||||||
@@ -277,7 +277,7 @@ TEST_CASE( "Comparisons between ints where one side is computed" )
 | 
				
			|||||||
     CHECK( 54 == 6*9 );
 | 
					     CHECK( 54 == 6*9 );
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef  __GNUC__
 | 
					#ifdef  CATCH_COMPILER_GCC
 | 
				
			||||||
#pragma GCC diagnostic pop
 | 
					#pragma GCC diagnostic pop
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -216,7 +216,7 @@ TEST_CASE( "CAPTURE can deal with complex expressions", "[messages][capture]" )
 | 
				
			|||||||
#pragma clang diagnostic push
 | 
					#pragma clang diagnostic push
 | 
				
			||||||
#pragma clang diagnostic ignored "-Wunused-value" // In (1, 2), the "1" is unused ...
 | 
					#pragma clang diagnostic ignored "-Wunused-value" // In (1, 2), the "1" is unused ...
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#ifdef __GNUC__
 | 
					#ifdef CATCH_COMPILER_GCC
 | 
				
			||||||
#pragma GCC diagnostic push
 | 
					#pragma GCC diagnostic push
 | 
				
			||||||
#pragma GCC diagnostic ignored "-Wunused-value" // All the comma operators are side-effect free
 | 
					#pragma GCC diagnostic ignored "-Wunused-value" // All the comma operators are side-effect free
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
@@ -243,7 +243,7 @@ std::ostream& operator<<(std::ostream& out, helper_1436<T1, T2> const& helper) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// Clang and gcc have different names for this warning, and clang also
 | 
					// Clang and gcc have different names for this warning, and clang also
 | 
				
			||||||
// warns about an unused value. This warning must be disabled for C++20.
 | 
					// warns about an unused value. This warning must be disabled for C++20.
 | 
				
			||||||
#if defined(__GNUG__) && !defined(__clang__)
 | 
					#if defined(CATCH_COMPILER_GCC) && __cplusplus
 | 
				
			||||||
#pragma GCC diagnostic push
 | 
					#pragma GCC diagnostic push
 | 
				
			||||||
#pragma GCC diagnostic ignored "-Wpragmas"
 | 
					#pragma GCC diagnostic ignored "-Wpragmas"
 | 
				
			||||||
#pragma GCC diagnostic ignored "-Wcomma-subscript"
 | 
					#pragma GCC diagnostic ignored "-Wcomma-subscript"
 | 
				
			||||||
@@ -265,7 +265,7 @@ TEST_CASE("CAPTURE can deal with complex expressions involving commas", "[messag
 | 
				
			|||||||
    SUCCEED();
 | 
					    SUCCEED();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __GNUG__
 | 
					#ifdef CATCH_COMPILER_GCC
 | 
				
			||||||
#pragma GCC diagnostic pop
 | 
					#pragma GCC diagnostic pop
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -279,7 +279,7 @@ TEST_CASE("CAPTURE parses string and character constants", "[messages][capture]"
 | 
				
			|||||||
#ifdef __clang__
 | 
					#ifdef __clang__
 | 
				
			||||||
#pragma clang diagnostic pop
 | 
					#pragma clang diagnostic pop
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#ifdef __GNUC__
 | 
					#ifdef CATCH_COMPILER_GCC
 | 
				
			||||||
#pragma GCC diagnostic pop
 | 
					#pragma GCC diagnostic pop
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#ifdef _MSC_VER
 | 
					#ifdef _MSC_VER
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,9 +8,9 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include <catch2/catch_test_macros.hpp>
 | 
					#include <catch2/catch_test_macros.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <catch2/internal/catch_compiler_capabilities.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(CATCH_COMPILER_GCC)
 | 
				
			||||||
#if defined(__GNUC__)
 | 
					 | 
				
			||||||
// This has to be left enabled until end of the TU, because the GCC
 | 
					// This has to be left enabled until end of the TU, because the GCC
 | 
				
			||||||
// frontend reports operator<<(std::ostream& os, const has_maker_and_operator&)
 | 
					// frontend reports operator<<(std::ostream& os, const has_maker_and_operator&)
 | 
				
			||||||
// as unused anyway
 | 
					// as unused anyway
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user