mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-11-04 05:59:32 +01:00 
			
		
		
		
	Split out INTERNAL_CATCH_UNIQUE_NAME into its own header
Also small cleanup of includes of related headers.
This commit is contained in:
		@@ -65,6 +65,7 @@ set(INTERNAL_HEADERS
 | 
				
			|||||||
    ${SOURCES_DIR}/internal/catch_errno_guard.hpp
 | 
					    ${SOURCES_DIR}/internal/catch_errno_guard.hpp
 | 
				
			||||||
    ${SOURCES_DIR}/internal/catch_exception_translator_registry.hpp
 | 
					    ${SOURCES_DIR}/internal/catch_exception_translator_registry.hpp
 | 
				
			||||||
    ${SOURCES_DIR}/internal/catch_fatal_condition_handler.hpp
 | 
					    ${SOURCES_DIR}/internal/catch_fatal_condition_handler.hpp
 | 
				
			||||||
 | 
					    ${SOURCES_DIR}/internal/catch_unique_name.hpp
 | 
				
			||||||
    ${SOURCES_DIR}/generators/catch_generator_exception.hpp
 | 
					    ${SOURCES_DIR}/generators/catch_generator_exception.hpp
 | 
				
			||||||
    ${SOURCES_DIR}/generators/catch_generators.hpp
 | 
					    ${SOURCES_DIR}/generators/catch_generators.hpp
 | 
				
			||||||
    ${SOURCES_DIR}/generators/catch_generators_adapters.hpp
 | 
					    ${SOURCES_DIR}/generators/catch_generators_adapters.hpp
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,6 +13,7 @@
 | 
				
			|||||||
#include <catch2/interfaces/catch_interfaces_config.hpp>
 | 
					#include <catch2/interfaces/catch_interfaces_config.hpp>
 | 
				
			||||||
#include <catch2/internal/catch_context.hpp>
 | 
					#include <catch2/internal/catch_context.hpp>
 | 
				
			||||||
#include <catch2/interfaces/catch_interfaces_reporter.hpp>
 | 
					#include <catch2/interfaces/catch_interfaces_reporter.hpp>
 | 
				
			||||||
 | 
					#include <catch2/internal/catch_unique_name.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <catch2/benchmark/catch_chronometer.hpp>
 | 
					#include <catch2/benchmark/catch_chronometer.hpp>
 | 
				
			||||||
#include <catch2/benchmark/catch_clock.hpp>
 | 
					#include <catch2/benchmark/catch_clock.hpp>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -100,6 +100,7 @@
 | 
				
			|||||||
#include <catch2/internal/catch_textflow.hpp>
 | 
					#include <catch2/internal/catch_textflow.hpp>
 | 
				
			||||||
#include <catch2/internal/catch_to_string.hpp>
 | 
					#include <catch2/internal/catch_to_string.hpp>
 | 
				
			||||||
#include <catch2/internal/catch_uncaught_exceptions.hpp>
 | 
					#include <catch2/internal/catch_uncaught_exceptions.hpp>
 | 
				
			||||||
 | 
					#include <catch2/internal/catch_unique_name.hpp>
 | 
				
			||||||
#include <catch2/internal/catch_unique_ptr.hpp>
 | 
					#include <catch2/internal/catch_unique_ptr.hpp>
 | 
				
			||||||
#include <catch2/internal/catch_wildcard_pattern.hpp>
 | 
					#include <catch2/internal/catch_wildcard_pattern.hpp>
 | 
				
			||||||
#include <catch2/internal/catch_windows_h_proxy.hpp>
 | 
					#include <catch2/internal/catch_windows_h_proxy.hpp>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,6 +9,7 @@
 | 
				
			|||||||
#define CATCH_TAG_ALIAS_AUTOREGISTRAR_HPP_INCLUDED
 | 
					#define CATCH_TAG_ALIAS_AUTOREGISTRAR_HPP_INCLUDED
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <catch2/internal/catch_compiler_capabilities.hpp>
 | 
					#include <catch2/internal/catch_compiler_capabilities.hpp>
 | 
				
			||||||
 | 
					#include <catch2/internal/catch_unique_name.hpp>
 | 
				
			||||||
#include <catch2/internal/catch_source_line_info.hpp>
 | 
					#include <catch2/internal/catch_source_line_info.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace Catch {
 | 
					namespace Catch {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,6 +13,8 @@
 | 
				
			|||||||
#include <catch2/internal/catch_preprocessor.hpp>
 | 
					#include <catch2/internal/catch_preprocessor.hpp>
 | 
				
			||||||
#include <catch2/internal/catch_section.hpp>
 | 
					#include <catch2/internal/catch_section.hpp>
 | 
				
			||||||
#include <catch2/internal/catch_test_registry.hpp>
 | 
					#include <catch2/internal/catch_test_registry.hpp>
 | 
				
			||||||
 | 
					#include <catch2/internal/catch_unique_name.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// All of our user-facing macros support configuration toggle, that
 | 
					// All of our user-facing macros support configuration toggle, that
 | 
				
			||||||
// forces them to be defined prefixed with CATCH_. We also like to
 | 
					// forces them to be defined prefixed with CATCH_. We also like to
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,6 +9,8 @@
 | 
				
			|||||||
#define CATCH_TRANSLATE_EXCEPTION_HPP_INCLUDED
 | 
					#define CATCH_TRANSLATE_EXCEPTION_HPP_INCLUDED
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <catch2/interfaces/catch_interfaces_exception.hpp>
 | 
					#include <catch2/interfaces/catch_interfaces_exception.hpp>
 | 
				
			||||||
 | 
					#include <catch2/internal/catch_compiler_capabilities.hpp>
 | 
				
			||||||
 | 
					#include <catch2/internal/catch_unique_name.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <exception>
 | 
					#include <exception>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,7 +9,6 @@
 | 
				
			|||||||
#define CATCH_INTERFACES_EXCEPTION_HPP_INCLUDED
 | 
					#define CATCH_INTERFACES_EXCEPTION_HPP_INCLUDED
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <catch2/interfaces/catch_interfaces_registry_hub.hpp>
 | 
					#include <catch2/interfaces/catch_interfaces_registry_hub.hpp>
 | 
				
			||||||
#include <catch2/internal/catch_compiler_capabilities.hpp>
 | 
					 | 
				
			||||||
#include <catch2/internal/catch_unique_ptr.hpp>
 | 
					#include <catch2/internal/catch_unique_ptr.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <string>
 | 
					#include <string>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,8 +13,7 @@
 | 
				
			|||||||
#include <catch2/catch_section_info.hpp>
 | 
					#include <catch2/catch_section_info.hpp>
 | 
				
			||||||
#include <catch2/catch_timer.hpp>
 | 
					#include <catch2/catch_timer.hpp>
 | 
				
			||||||
#include <catch2/catch_totals.hpp>
 | 
					#include <catch2/catch_totals.hpp>
 | 
				
			||||||
 | 
					#include <catch2/internal/catch_unique_name.hpp>
 | 
				
			||||||
#include <string>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace Catch {
 | 
					namespace Catch {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,19 +8,9 @@
 | 
				
			|||||||
#ifndef CATCH_SOURCE_LINE_INFO_HPP_INCLUDED
 | 
					#ifndef CATCH_SOURCE_LINE_INFO_HPP_INCLUDED
 | 
				
			||||||
#define CATCH_SOURCE_LINE_INFO_HPP_INCLUDED
 | 
					#define CATCH_SOURCE_LINE_INFO_HPP_INCLUDED
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <catch2/internal/catch_config_counter.hpp>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <cstddef>
 | 
					#include <cstddef>
 | 
				
			||||||
#include <iosfwd>
 | 
					#include <iosfwd>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) name##line
 | 
					 | 
				
			||||||
#define INTERNAL_CATCH_UNIQUE_NAME_LINE( name, line ) INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line )
 | 
					 | 
				
			||||||
#ifdef CATCH_CONFIG_COUNTER
 | 
					 | 
				
			||||||
#  define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __COUNTER__ )
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
#  define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __LINE__ )
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// We need a dummy global operator<< so we can bring it into Catch namespace later
 | 
					// We need a dummy global operator<< so we can bring it into Catch namespace later
 | 
				
			||||||
struct Catch_global_namespace_dummy {};
 | 
					struct Catch_global_namespace_dummy {};
 | 
				
			||||||
std::ostream& operator<<(std::ostream&, Catch_global_namespace_dummy);
 | 
					std::ostream& operator<<(std::ostream&, Catch_global_namespace_dummy);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,6 +12,8 @@
 | 
				
			|||||||
#include <catch2/internal/catch_compiler_capabilities.hpp>
 | 
					#include <catch2/internal/catch_compiler_capabilities.hpp>
 | 
				
			||||||
#include <catch2/internal/catch_preprocessor.hpp>
 | 
					#include <catch2/internal/catch_preprocessor.hpp>
 | 
				
			||||||
#include <catch2/internal/catch_meta.hpp>
 | 
					#include <catch2/internal/catch_meta.hpp>
 | 
				
			||||||
 | 
					#include <catch2/internal/catch_unique_name.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 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
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,6 +11,7 @@
 | 
				
			|||||||
#include <catch2/internal/catch_assertion_handler.hpp>
 | 
					#include <catch2/internal/catch_assertion_handler.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>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 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
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,6 +13,7 @@
 | 
				
			|||||||
#include <catch2/interfaces/catch_interfaces_testcase.hpp>
 | 
					#include <catch2/interfaces/catch_interfaces_testcase.hpp>
 | 
				
			||||||
#include <catch2/internal/catch_stringref.hpp>
 | 
					#include <catch2/internal/catch_stringref.hpp>
 | 
				
			||||||
#include <catch2/internal/catch_unique_ptr.hpp>
 | 
					#include <catch2/internal/catch_unique_ptr.hpp>
 | 
				
			||||||
 | 
					#include <catch2/internal/catch_unique_name.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 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
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										20
									
								
								src/catch2/internal/catch_unique_name.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								src/catch2/internal/catch_unique_name.hpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,20 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					//              Copyright Catch2 Authors
 | 
				
			||||||
 | 
					// Distributed under the Boost Software License, Version 1.0.
 | 
				
			||||||
 | 
					//   (See accompanying file LICENSE_1_0.txt or copy at
 | 
				
			||||||
 | 
					//        https://www.boost.org/LICENSE_1_0.txt)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// SPDX-License-Identifier: BSL-1.0
 | 
				
			||||||
 | 
					#ifndef CATCH_UNIQUE_NAME_HPP_INCLUDED
 | 
				
			||||||
 | 
					#define CATCH_UNIQUE_NAME_HPP_INCLUDED
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <catch2/internal/catch_config_counter.hpp>
 | 
				
			||||||
 | 
					#define INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) name##line
 | 
				
			||||||
 | 
					#define INTERNAL_CATCH_UNIQUE_NAME_LINE( name, line ) INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line )
 | 
				
			||||||
 | 
					#ifdef CATCH_CONFIG_COUNTER
 | 
				
			||||||
 | 
					#  define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __COUNTER__ )
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					#  define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __LINE__ )
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif // CATCH_UNIQUE_NAME_HPP_INCLUDED
 | 
				
			||||||
		Reference in New Issue
	
	Block a user