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

Call to undeclared library function '_BitScanForward' with VS2022 ClanCl #184

Open
eres-j opened this issue Aug 5, 2024 · 2 comments
Open

Comments

@eres-j
Copy link

eres-j commented Aug 5, 2024

Hi,

I use WavPack via SDL_Mixer and I recently let my project build using VS2022 ClangCl and got the following error:
SDL_mixer\external\wavpack\src\read_words.c(136,30): error : call to undeclared library function '_BitScanForward' with type 'unsigned char (unsigned long *, unsigned long)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

Step to reproduce (in SDL_mixer\external\wavpack):

"%ProgramFiles%\CMake\bin\cmake.exe" -B build -G "Visual Studio 17 2022" -A x64 -T ClangCl
"%ProgramFiles%\CMake\bin\cmake.exe" --build "build" --config Release

Potential fix:
I locally patched read_words.c by adding this at line 29

#if defined(_MSC_VER) && defined(__clang__)
#include <intrin.h>
#endif

The compiler also give some warnings which could be nice to fix as well:

SDL_mixer\external\wavpack\src\unpack_dsd.c(510,9): warning : variable 'skipped_terms' set but not used [-Wunused-but-set-variable]
SDL_mixer\external\wavpack\cli\wvtag.c(1351,37): warning : passing 'char *' to parameter of type 'const unsigned char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
SDL_mixer\external\wavpack\cli\wvunpack.c(3347,37): warning : passing 'char *' to parameter of type 'const unsigned char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]

Let me know if you need more information :)

@dbry
Copy link
Owner

dbry commented Aug 8, 2024

Thanks for letting me know about this!

On the warnings, the line numbers reported don't seem to match the code. I checked against both my repo and the SDL one. The first warning is easy enough without the exact line, but the other two aren't. For example, line 1351 of wvtag.c is blank and line 3347 of wvunpack.c has no call or pointers.

@eres-j
Copy link
Author

eres-j commented Aug 9, 2024

You're welcome :)

Both last 2 warning are for this same call: int act_chars = UTF8ToWideChar (string, temp); in UTF8ToAnsi function.

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

No branches or pull requests

2 participants