-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
CATCH_CONFIG_MAIN isn't __cdecl, causing x86 build failures #2486
Comments
Here https://docs.microsoft.com/en-us/cpp/c-language/using-wmain?view=msvc-170 there is nothing that says one needs to specify Can you post full reproduction with manual compiler invocation will all CLI parametars or complete cmake script. |
Here's the warning it gives (docs are for main, but it handles wmain the same): I think the default calling convention on x86 is __cdecl, so most times it wouldn't be noticed, but the default calling convention can be changed with compiler args. I'll work on figuring on a repro cl exe command line. |
Yep, it's /Gz (or probably other /G<> options) with warning level 4.
The same problem actually applies to main as well (when running without /DUNICODE /D_UNICODE):
|
Well, why are you changing the default calling convention in the first place? Those flags should be avoided and can be used only when you have full control of the whole source code including all the libraries. If you use third-party libraries, especially via package manager, you should not use those flags. If you use them you should be aware there are consequences. For example, you have library compiled with ABI 1, but you consume it via its headers and on the consumption side you specify ABI 2. Kaboom. |
It's a publicly supported flag. In this case, we're building Windows itself. |
Fixes #2486 Co-authored-by: Martin Hořeňovský <martin.horenovsky@gmail.com>
Autoclose won't catch this as it didn't go to the default branch. |
Describe the bug
See title
Expected behavior
#define CATCH_CONFIG_MAIN works on x86.
Reproduction steps
Building on x86:
Platform information:
The text was updated successfully, but these errors were encountered: