mirror of
https://github.com/wolfpld/tracy.git
synced 2026-07-24 06:59:14 +00:00
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.
36 lines
945 B
C
36 lines
945 B
C
#ifndef __TRACYCALLSTACK_H__
|
|
#define __TRACYCALLSTACK_H__
|
|
|
|
#ifndef TRACY_NO_CALLSTACK
|
|
|
|
# if defined _WIN32
|
|
# include "../common/TracyWinFamily.hpp"
|
|
# if !defined TRACY_WIN32_NO_DESKTOP
|
|
# define TRACY_HAS_CALLSTACK 1
|
|
# endif
|
|
# elif defined __ANDROID__
|
|
# if !defined __arm__ || __ANDROID_API__ >= 21
|
|
# define TRACY_HAS_CALLSTACK 2
|
|
# else
|
|
# define TRACY_HAS_CALLSTACK 5
|
|
# endif
|
|
# elif defined __linux
|
|
# if defined _GNU_SOURCE && defined __GLIBC__
|
|
# define TRACY_HAS_CALLSTACK 3
|
|
# else
|
|
# define TRACY_HAS_CALLSTACK 2
|
|
# endif
|
|
# elif defined __APPLE__
|
|
# define TRACY_HAS_CALLSTACK 4
|
|
# elif defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ || defined __DragonFly__
|
|
# define TRACY_HAS_CALLSTACK 6
|
|
# endif
|
|
|
|
#if TRACY_HAS_CALLSTACK == 2 || TRACY_HAS_CALLSTACK == 3 || TRACY_HAS_CALLSTACK == 4 || TRACY_HAS_CALLSTACK == 6
|
|
#define TRACY_USE_LIBBACKTRACE
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif
|