6191: Use own defines of format specifiers for MinGW (fixes #6187) r=Jupeyy a=Chairn

Counter proposition to #6188. Redefines our own specifiers

## Checklist

- [ ] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Chairn <chairn.nq@hotmail.fr>
This commit is contained in:
bors[bot] 2022-12-28 20:59:17 +00:00 committed by GitHub
commit f230ad0bdc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 12 deletions

View file

@ -14,9 +14,20 @@
#define __USE_GNU
#endif
#include <inttypes.h>
#include <stdint.h>
#include <time.h>
#ifdef __MINGW32__
#undef PRId64
#undef PRIu64
#define PRId64 "I64d"
#define PRIu64 "I64u"
#define PRIzu "Iu"
#else
#define PRIzu "zu"
#endif
#ifdef CONF_FAMILY_UNIX
#include <sys/un.h>
#endif

View file

@ -87,7 +87,7 @@ class CCommandProcessorFragment_Vulkan : public CCommandProcessorFragment_GLBase
break;
default: break;
}
dbg_msg("vulkan", "allocated chunk of memory with size: %zu for frame %zu (%s)", (size_t)Size, (size_t)m_CurImageIndex, pUsage);
dbg_msg("vulkan", "allocated chunk of memory with size: %" PRIzu " for frame %" PRIzu " (%s)", (size_t)Size, (size_t)m_CurImageIndex, pUsage);
}
void VerboseDeallocatedMemory(VkDeviceSize Size, size_t FrameImageIndex, EMemoryBlockUsage MemUsage)
@ -109,7 +109,7 @@ class CCommandProcessorFragment_Vulkan : public CCommandProcessorFragment_GLBase
break;
default: break;
}
dbg_msg("vulkan", "deallocated chunk of memory with size: %zu for frame %zu (%s)", (size_t)Size, (size_t)m_CurImageIndex, pUsage);
dbg_msg("vulkan", "deallocated chunk of memory with size: %" PRIzu " for frame %" PRIzu " (%s)", (size_t)Size, (size_t)m_CurImageIndex, pUsage);
}
/************************
@ -2057,7 +2057,7 @@ protected:
m_pStagingMemoryUsage->store(m_pStagingMemoryUsage->load(std::memory_order_relaxed) - FreeedMemory, std::memory_order_relaxed);
if(IsVerbose())
{
dbg_msg("vulkan", "deallocated chunks of memory with size: %zu from all frames (staging buffer)", (size_t)FreeedMemory);
dbg_msg("vulkan", "deallocated chunks of memory with size: %" PRIzu " from all frames (staging buffer)", (size_t)FreeedMemory);
}
}
FreeedMemory = 0;
@ -2067,7 +2067,7 @@ protected:
m_pBufferMemoryUsage->store(m_pBufferMemoryUsage->load(std::memory_order_relaxed) - FreeedMemory, std::memory_order_relaxed);
if(IsVerbose())
{
dbg_msg("vulkan", "deallocated chunks of memory with size: %zu from all frames (buffer)", (size_t)FreeedMemory);
dbg_msg("vulkan", "deallocated chunks of memory with size: %" PRIzu " from all frames (buffer)", (size_t)FreeedMemory);
}
}
FreeedMemory = 0;
@ -2078,7 +2078,7 @@ protected:
m_pTextureMemoryUsage->store(m_pTextureMemoryUsage->load(std::memory_order_relaxed) - FreeedMemory, std::memory_order_relaxed);
if(IsVerbose())
{
dbg_msg("vulkan", "deallocated chunks of memory with size: %zu from all frames (texture)", (size_t)FreeedMemory);
dbg_msg("vulkan", "deallocated chunks of memory with size: %" PRIzu " from all frames (texture)", (size_t)FreeedMemory);
}
}
}
@ -3817,7 +3817,7 @@ public:
if(IsVerbose())
{
dbg_msg("vulkan", "device prop: non-coherent align: %zu, optimal image copy align: %zu, max texture size: %u, max sampler anisotropy: %u", (size_t)m_NonCoherentMemAlignment, (size_t)m_OptimalImageCopyMemAlignment, m_MaxTextureSize, m_MaxSamplerAnisotropy);
dbg_msg("vulkan", "device prop: non-coherent align: %" PRIzu ", optimal image copy align: %" PRIzu ", max texture size: %u, max sampler anisotropy: %u", (size_t)m_NonCoherentMemAlignment, (size_t)m_OptimalImageCopyMemAlignment, m_MaxTextureSize, m_MaxSamplerAnisotropy);
dbg_msg("vulkan", "device prop: min uniform align: %u, multi sample: %u", m_MinUniformAlign, (uint32_t)m_MaxMultiSample);
}
}
@ -7634,7 +7634,7 @@ public:
if(IsVerbose() && s_BenchmarkRenderThreads)
{
dbg_msg("vulkan", "render thread %zu took %d ns to finish", ThreadIndex, (int)(time_get_nanoseconds() - ThreadRenderTime).count());
dbg_msg("vulkan", "render thread %" PRIzu " took %d ns to finish", ThreadIndex, (int)(time_get_nanoseconds() - ThreadRenderTime).count());
}
pThread->m_IsRendering = false;

View file

@ -70,11 +70,6 @@
#include "base/hash.h"
// for msvc
#ifndef PRIu64
#define PRIu64 "I64u"
#endif
#include <chrono>
#include <thread>