Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMartin Hořeňovský2025-09-22 15:12:28 +0200
committerMartin Hořeňovský2025-09-22 15:36:46 +0200
commit9048c24fa7c6b568d52f76cbf06bbd62b7f83556 (patch)
tree5257d7727a2b615277d58e5a4ccebb71e80a2019
parent8ed8c431c601c7b303dbfe7eb412a63f1641b812 (diff)
downloadcatch3-9048c24fa7c6b568d52f76cbf06bbd62b7f83556.tar.gz
Improve QNX support
This cherry-picks the source changes from PR made by @pkleymonov-qnx, without including the build path changes that are irrelevant unless we can add a QNX target to our CI. Close #2953
-rw-r--r--src/catch2/internal/catch_console_colour.cpp6
-rw-r--r--src/catch2/internal/catch_debugger.cpp2
-rw-r--r--src/catch2/internal/catch_debugger.hpp2
-rw-r--r--src/catch2/internal/catch_platform.hpp3
-rw-r--r--tests/ExtraTests/CMakeLists.txt2
5 files changed, 11 insertions, 4 deletions
diff --git a/src/catch2/internal/catch_console_colour.cpp b/src/catch2/internal/catch_console_colour.cpp
index 514fc6b6..948c4cb6 100644
--- a/src/catch2/internal/catch_console_colour.cpp
+++ b/src/catch2/internal/catch_console_colour.cpp
@@ -161,7 +161,11 @@ namespace {
#endif // Windows/ ANSI/ None
-#if defined( CATCH_PLATFORM_LINUX ) || defined( CATCH_PLATFORM_MAC ) || defined( __GLIBC__ ) || defined(__FreeBSD__)
+#if defined( CATCH_PLATFORM_LINUX ) \
+ || defined( CATCH_PLATFORM_MAC ) \
+ || defined( __GLIBC__ ) \
+ || defined( __FreeBSD__ ) \
+ || defined( CATCH_PLATFORM_QNX )
# define CATCH_INTERNAL_HAS_ISATTY
# include <unistd.h>
#endif
diff --git a/src/catch2/internal/catch_debugger.cpp b/src/catch2/internal/catch_debugger.cpp
index bd3be172..da22c7fd 100644
--- a/src/catch2/internal/catch_debugger.cpp
+++ b/src/catch2/internal/catch_debugger.cpp
@@ -69,7 +69,7 @@
#endif
} // namespace Catch
-#elif defined(CATCH_PLATFORM_LINUX)
+#elif defined(CATCH_PLATFORM_LINUX) || defined(CATCH_PLATFORM_QNX)
#include <fstream>
#include <string>
diff --git a/src/catch2/internal/catch_debugger.hpp b/src/catch2/internal/catch_debugger.hpp
index 515ec763..997f4406 100644
--- a/src/catch2/internal/catch_debugger.hpp
+++ b/src/catch2/internal/catch_debugger.hpp
@@ -49,7 +49,7 @@ namespace Catch {
#define CATCH_TRAP() __asm__(".inst 0xde01")
#endif
-#elif defined(CATCH_PLATFORM_LINUX)
+#elif defined(CATCH_PLATFORM_LINUX) || defined(CATCH_PLATFORM_QNX)
// If we can use inline assembler, do it because this allows us to break
// directly at the location of the failing check instead of breaking inside
// raise() called from it, i.e. one stack frame below.
diff --git a/src/catch2/internal/catch_platform.hpp b/src/catch2/internal/catch_platform.hpp
index b653a58c..ba4717f0 100644
--- a/src/catch2/internal/catch_platform.hpp
+++ b/src/catch2/internal/catch_platform.hpp
@@ -25,6 +25,9 @@
#elif defined(linux) || defined(__linux) || defined(__linux__)
# define CATCH_PLATFORM_LINUX
+#elif defined(__QNX__)
+# define CATCH_PLATFORM_QNX
+
#elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) || defined(__MINGW32__)
# define CATCH_PLATFORM_WINDOWS
diff --git a/tests/ExtraTests/CMakeLists.txt b/tests/ExtraTests/CMakeLists.txt
index 28f545c5..d7ae548b 100644
--- a/tests/ExtraTests/CMakeLists.txt
+++ b/tests/ExtraTests/CMakeLists.txt
@@ -95,7 +95,7 @@ foreach(target DisabledExceptions-DefaultHandler DisabledExceptions-CustomHandle
target_compile_options(${target}
PUBLIC
$<$<CXX_COMPILER_ID:MSVC>:/EHs-c-;/D_HAS_EXCEPTIONS=0>
- $<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:GNU>,$<CXX_COMPILER_ID:AppleClang>>:-fno-exceptions>
+ $<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:GNU>,$<CXX_COMPILER_ID:QCC>,$<CXX_COMPILER_ID:AppleClang>>:-fno-exceptions>
)
target_link_libraries(${target} Catch2_buildall_interface)
endforeach()