From 980c20694ecb60e3671ee3c08a53b4b720f5d4ae Mon Sep 17 00:00:00 2001 From: Dimitrij Mijoski Date: Mon, 3 Oct 2022 15:36:37 +0200 Subject: [PATCH] Don't expose header windows.h in catch_all.hpp (#2526) * Don't expose header windows.h in catch_all.hpp * Fix generateAmalgamatedFiles.py --- src/catch2/catch_all.hpp | 1 - src/catch2/internal/catch_windows_h_proxy.hpp | 4 ---- tools/scripts/checkConvenienceHeaders.py | 3 ++- tools/scripts/generateAmalgamatedFiles.py | 1 + 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/catch2/catch_all.hpp b/src/catch2/catch_all.hpp index 94f55223..bd83f5a7 100644 --- a/src/catch2/catch_all.hpp +++ b/src/catch2/catch_all.hpp @@ -114,7 +114,6 @@ #include #include #include -#include #include #include #include diff --git a/src/catch2/internal/catch_windows_h_proxy.hpp b/src/catch2/internal/catch_windows_h_proxy.hpp index 14fe747d..0d260302 100644 --- a/src/catch2/internal/catch_windows_h_proxy.hpp +++ b/src/catch2/internal/catch_windows_h_proxy.hpp @@ -21,11 +21,7 @@ # define WIN32_LEAN_AND_MEAN #endif -#ifdef __AFXDLL -#include -#else #include -#endif #endif // defined(CATCH_PLATFORM_WINDOWS) diff --git a/tools/scripts/checkConvenienceHeaders.py b/tools/scripts/checkConvenienceHeaders.py index 054d3bd9..41b52ced 100755 --- a/tools/scripts/checkConvenienceHeaders.py +++ b/tools/scripts/checkConvenienceHeaders.py @@ -120,7 +120,8 @@ def verify_convenience_header(folder): # 4) Are all required headers present? file_incs_set = set(file_incs) for include in target_includes: - if include not in file_incs_set: + if (include not in file_incs_set and + include != 'catch2/internal/catch_windows_h_proxy.hpp'): errors_found = True print("'{}': missing include '{}'".format(header_name, include)) diff --git a/tools/scripts/generateAmalgamatedFiles.py b/tools/scripts/generateAmalgamatedFiles.py index 812712a3..172353e6 100755 --- a/tools/scripts/generateAmalgamatedFiles.py +++ b/tools/scripts/generateAmalgamatedFiles.py @@ -108,6 +108,7 @@ def generate_cpp(): with open(output_cpp, mode='w', encoding='utf-8') as cpp: cpp.write(formatted_file_header(Version())) cpp.write('\n#include "catch_amalgamated.hpp"\n') + concatenate_file(cpp, os.path.join(root_path, 'catch2/internal/catch_windows_h_proxy.hpp'), False) for file in cpp_files: concatenate_file(cpp, file, False) print('Concatenated {} cpp files'.format(len(cpp_files)))