[PATCH 0/1] MR2935: include: Fix the use of __getReg for aarch64/msvc mode
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(a)martin.st> -- https://gitlab.winehq.org/wine/wine/-/merge_requests/2935
From: Martin Storsjö <martin(a)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(a)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) { -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/2935
Should the prototype be added to `include/msvcrt/intrin.h` instead? -- https://gitlab.winehq.org/wine/wine/-/merge_requests/2935#note_34229
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.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/2935#note_34238
Indeed, it seems that all these prototypes should go into intrin.h. This can be a separate MR though. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/2935#note_34239
participants (3)
-
Alexandre Julliard (@julliard) -
Brendan Shanks (@bshanks) -
Martin Storsjö