mirror of
https://github.com/wolfpld/tracy.git
synced 2026-10-02 15:05:26 +00:00
Drop sys/param.h dependency for BSD detection
Replace `#ifdef BSD` (which requires including `<sys/param.h>` first) with explicit checks for `__FreeBSD__`, `__NetBSD__`, `__OpenBSD__` and `__DragonFly__`, matching how these BSDs are already enumerated elsewhere in the codebase (OS name strings, thread id helpers, etc.). This also avoids leaking the `sys/param.h` requirement through public headers (`TracySysTime.hpp`, `TracyCallstack.h`), where consumers would otherwise need it to correctly see `TRACY_HAS_SYSTIME` / `TRACY_HAS_CALLSTACK`. `libbacktrace/config.h` is left as-is — it's third-party and only included from .c files where the `BSD` macro can still be picked up locally. Note: for `setsockopt( m_sock, IPPROTO_IPV6, IPV6_V6ONLY, (const char*)&val, sizeof( val ) );` I added `__APPLE__` too since this was the only place where it was not checked explicitely.
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
# include <windows.h>
|
||||
#elif defined __linux__
|
||||
# include <sys/sysinfo.h>
|
||||
#elif defined __APPLE__ || defined BSD
|
||||
#elif defined __APPLE__ || defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ || defined __DragonFly__
|
||||
# include <sys/types.h>
|
||||
# include <sys/sysctl.h>
|
||||
#endif
|
||||
@@ -30,7 +30,7 @@ size_t GetPhysicalMemorySize()
|
||||
size_t sz = sizeof( memSize );
|
||||
sysctlbyname( "hw.memsize", &memSize, &sz, nullptr, 0 );
|
||||
return memSize;
|
||||
#elif defined BSD
|
||||
#elif defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ || defined __DragonFly__
|
||||
size_t memSize;
|
||||
size_t sz = sizeof( memSize );
|
||||
sysctlbyname( "hw.physmem", &memSize, &sz, nullptr, 0 );
|
||||
|
||||
Reference in New Issue
Block a user