Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows_h_proxy is included in catch_all.hpp and does name-polution #2432

Closed
dimztimz opened this issue May 20, 2022 · 1 comment · Fixed by #2526
Closed

Windows_h_proxy is included in catch_all.hpp and does name-polution #2432

dimztimz opened this issue May 20, 2022 · 1 comment · Fixed by #2526

Comments

@dimztimz
Copy link
Contributor

Describe the bug
If I include catch2/catch_all.hpp on Windows it transitively includes windows.h which defines a lot of preprocessor definitions whose names will be in conflict with my code.

Expected behavior
Windows.h should be included only in the implementation files of catch2, not in the public headers.

Reproduction steps
See description above.

Platform information:

  • OS: Windows NT
  • Compiler+version: GCC 11 (Mingw64)
  • Catch version: v3.0.1
@dimztimz dimztimz changed the title Windows_h_proxy is included in catch_all.hpp and which does name-polution Windows_h_proxy is included in catch_all.hpp and does name-polution May 20, 2022
@dimztimz
Copy link
Contributor Author

dimztimz commented Jun 10, 2022

Do you know how to fix this? I expected this to be an easy fix, remove just a line from catch_all.hpp, but this came up https://github.com/catchorg/Catch2/blob/devel/tools/scripts/checkConvenienceHeaders.py and makes the test-suite fail.

Maybe a better fix is to include windows.h directly where needed and completely delete this file catch_windows_h_proxy.hpp. An even better solution is to have public and private headers, install only the public headers and any scripts like the above one should test only for those. I'd go with the former solution right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant