Clang requires the __getReg function to be declared in addition to be declared as an intrinsic with the pragma.
This fixes the following error:
../wine/include/winnt.h:2412:27: error: call to undeclared library function '__getReg' with type 'unsigned long long (int)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] return (struct _TEB *)__getReg(18); ^ ../wine/include/winnt.h:2412:27: note: include the header <intrin.h> or explicitly provide a declaration for '__getReg' 1 error generated.
Signed-off-by: Martin Storsjö martin@martin.st
From: Martin Storsjö martin@martin.st
Clang requires the __getReg function to be declared in addition to be declared as an intrinsic with the pragma.
This fixes the following error:
../wine/include/winnt.h:2412:27: error: call to undeclared library function '__getReg' with type 'unsigned long long (int)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] return (struct _TEB *)__getReg(18); ^ ../wine/include/winnt.h:2412:27: note: include the header <intrin.h> or explicitly provide a declaration for '__getReg' 1 error generated.
Signed-off-by: Martin Storsjö martin@martin.st --- include/winnt.h | 1 + 1 file changed, 1 insertion(+)
diff --git a/include/winnt.h b/include/winnt.h index 0117100a921..409dbceee59 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -2406,6 +2406,7 @@ static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void) return __wine_current_teb; } #elif defined(__aarch64__) && defined(_MSC_VER) +unsigned __int64 __getReg(int); #pragma intrinsic(__getReg) static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void) {
Should the prototype be added to `include/msvcrt/intrin.h` instead?
On Wed May 31 19:51:32 2023 +0000, Brendan Shanks wrote:
Should the prototype be added to `include/msvcrt/intrin.h` instead?
Dunno, we seem to use this pattern with declaring these intrinsics right here for other architectures too (see `__readgsqword` for x86_64 right above). Curiously, `_MoveFromCoprocessor` doesn't seem to require a prototype, the pragma is enough - I tested that one too.
Indeed, it seems that all these prototypes should go into intrin.h. This can be a separate MR though.