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

libassert_msvc_pfunc is not defined when using Clang on Windows #104

Closed
MoshiKoi opened this issue Sep 15, 2024 · 3 comments
Closed

libassert_msvc_pfunc is not defined when using Clang on Windows #104

MoshiKoi opened this issue Sep 15, 2024 · 3 comments

Comments

@MoshiKoi
Copy link

For compatibility reasons, the Windows version of Clang defines _MSC_VER, meaning libassert detects the compiler as MSVC

#ifdef _MSC_VER
#define LIBASSERT_IS_MSVC 1
#define LIBASSERT_MSVC_VERSION _MSC_VER
#else
#define LIBASSERT_IS_MSVC 0
#define LIBASSERT_MSVC_VERSION 0
#endif

This causes some issues. For example, ASSERT_VAL eventually calls the LIBASSERT_INVOKE_VAL_PRETTY_FUNCTION_ARG macro which in this scenario relies on a built-in that Clang doesn't support:

#if LIBASSERT_IS_MSVC
#define LIBASSERT_INVOKE_VAL_PRETTY_FUNCTION_ARG ,libassert::detail::pretty_function_name_wrapper{libassert_msvc_pfunc}
#else

I think this can be fixed by just replacing the #ifdef _MSC_VER with #if defined(_MSC_VER) && !defined(__clang__). It fixes the ASSERT_VAL issue, but I'm not sure what else might change (though it should be fine since presumably it'll just switch to the clang version of libassert everywhere else as well).

@jeremy-rifkin
Copy link
Owner

jeremy-rifkin commented Sep 26, 2024

Thanks for opening this, should be a quick fix! I can take more of a look at this tomorrow or Friday. Might be an unintended consequence of #93.

@jeremy-rifkin
Copy link
Owner

Fixed in e55076c

@jeremy-rifkin
Copy link
Owner

2.1.2 is released with a fix for this

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

No branches or pull requests

2 participants