From 0fb054ca9a195d80e2bb165b05a0cc540cc3768e Mon Sep 17 00:00:00 2001 From: Undefine Date: Fri, 10 Oct 2025 23:32:06 +0200 Subject: [PATCH 1/2] Hide the fileno function on non Windows platforms It's unused there and conflicts with the macro definition of fileno on OpenBSD. --- src/utils/utils.cpp | 6 ++---- src/utils/utils.hpp | 2 ++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/utils/utils.cpp b/src/utils/utils.cpp index fb806937..480e5ea6 100644 --- a/src/utils/utils.cpp +++ b/src/utils/utils.cpp @@ -23,13 +23,11 @@ namespace detail { #endif } +#if IS_WINDOWS int fileno(std::FILE* stream) { - #if IS_WINDOWS return _fileno(stream); - #else - return ::fileno(stream); - #endif } +#endif void enable_virtual_terminal_processing_if_needed() noexcept { // enable colors / ansi processing if necessary diff --git a/src/utils/utils.hpp b/src/utils/utils.hpp index d255940d..e9f32b99 100644 --- a/src/utils/utils.hpp +++ b/src/utils/utils.hpp @@ -20,7 +20,9 @@ CPPTRACE_BEGIN_NAMESPACE namespace detail { bool isatty(int fd); +#if IS_WINDOWS int fileno(std::FILE* stream); +#endif void enable_virtual_terminal_processing_if_needed() noexcept; From 0d99cd602f4db011f048a64dee6ba5a0d72b0070 Mon Sep 17 00:00:00 2001 From: Undefine Date: Fri, 10 Oct 2025 23:32:42 +0200 Subject: [PATCH 2/2] Add support FreeBSD, OpenBSD and NetBSD All that is required to add support for those is to define them as being Linux which works because they are close enough. --- src/platform/platform.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platform/platform.hpp b/src/platform/platform.hpp index 89206e82..f89962ce 100644 --- a/src/platform/platform.hpp +++ b/src/platform/platform.hpp @@ -8,7 +8,7 @@ #if defined(_WIN32) #undef IS_WINDOWS #define IS_WINDOWS 1 -#elif defined(__linux) +#elif defined(__linux) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) #undef IS_LINUX #define IS_LINUX 1 #elif defined(__APPLE__)