Minecraft.World (build): Clang compilation fixes

This commit is contained in:
Anaël committed 2026-11-30 07:19:01 +01:00
1 parent c409324bb7
commit ea80182494
17 files changed
+182 -140

No files matched your search

+15 -3
View File
@@ -13,13 +13,13 @@ void SetThreadName( DWORD dwThreadID, LPCSTR szThreadName )
{
#ifndef __PS3__
THREADNAME_INFO info;
info.dwType = 0x1000;
info.szName = szThreadName;
info.dwThreadID = dwThreadID;
info.dwFlags = 0;
#if ( (defined(_WINDOWS64) || defined(__linux__)) | defined _DURANGO )
#if (defined(_WINDOWS64) || defined(_DURANGO))
__try
{
RaiseException(0x406D1388, 0, sizeof(info)/sizeof(ULONG_PTR), (ULONG_PTR *)&info);
@@ -37,5 +37,17 @@ void SetThreadName( DWORD dwThreadID, LPCSTR szThreadName )
{
}
#endif
#if defined(__linux__)
(void)dwThreadID;
if (!szThreadName) return;
// Note: Linux limits thread names to 15 chars, if you try to use a bigger one it will fail silently and be hard to debug
// we truncate in case this happens
char truncated[16];
std::strncpy(truncated, szThreadName, sizeof(truncated) - 1);
truncated[sizeof(truncated) - 1] = '\0';
pthread_setname_np(pthread_self(), truncated);
#endif
#endif // __PS3__
}