From 581a38f0dd763a20752ed0779ada07e48ae0ddca Mon Sep 17 00:00:00 2001 From: Kyle Date: Fri, 27 Feb 2026 00:52:44 +0800 Subject: [PATCH 1/2] Add Graph::trace_assertion_failure and wire it into precondition helpers - Declare and stub Graph::trace_assertion_failure(bool, const char*, ...) - Call trace_assertion_failure(true, ...) in precondition_failure - Call trace_assertion_failure(false, ...) in non_fatal_precondition_failure - Remove dead OAG_TARGET_RELEASE guard that was never defined --- Sources/OpenAttributeGraphCxx/Graph/OAGGraphTracing.cpp | 7 +++++++ Sources/OpenAttributeGraphCxx/Misc/assert.cpp | 7 +++---- .../include/OpenAttributeGraphCxx/Graph/Graph.hpp | 2 ++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Sources/OpenAttributeGraphCxx/Graph/OAGGraphTracing.cpp b/Sources/OpenAttributeGraphCxx/Graph/OAGGraphTracing.cpp index dedaa8df..69f030ba 100644 --- a/Sources/OpenAttributeGraphCxx/Graph/OAGGraphTracing.cpp +++ b/Sources/OpenAttributeGraphCxx/Graph/OAGGraphTracing.cpp @@ -3,6 +3,13 @@ // OpenAttributeGraphCxx #include +#include + +namespace OAG { +void Graph::trace_assertion_failure(bool remove, const char *format, ...) OAG_NOEXCEPT { + // TODO +} +} /* OAG */ void OAGGraphStartTracing(_Nullable OAGGraphRef graph, OAGGraphTraceOptions options) { OAGGraphStartTracing2(graph, options, NULL); diff --git a/Sources/OpenAttributeGraphCxx/Misc/assert.cpp b/Sources/OpenAttributeGraphCxx/Misc/assert.cpp index 08523dee..483221e5 100644 --- a/Sources/OpenAttributeGraphCxx/Misc/assert.cpp +++ b/Sources/OpenAttributeGraphCxx/Misc/assert.cpp @@ -4,6 +4,7 @@ #include #include +#include #include #include @@ -19,9 +20,7 @@ void precondition_failure(const char *format, ...) { va_end(va); if (s != nullptr) { platform_log_error(error_log(), "precondition failure: %s", s); - #if OAG_TARGET_RELEASE >= OAG_RELEASE_2023 - // OAG::Graph::trace_assertion_failure(true, "precondition failure: %s", s) - #endif + Graph::trace_assertion_failure(true, "precondition failure: %s", s); if (error_message == nullptr) { asprintf(&error_message, "OpenAttributeGraph precondition failure: %s.\n", s); } @@ -38,8 +37,8 @@ void non_fatal_precondition_failure(const char *format, ...) { va_end(va); if (s != nullptr) { platform_log_fault(error_log(), "precondition failure: %s", s); + Graph::trace_assertion_failure(false, "precondition failure: %s", s); free(s); } - return; } } /* OAG */ diff --git a/Sources/OpenAttributeGraphCxx/include/OpenAttributeGraphCxx/Graph/Graph.hpp b/Sources/OpenAttributeGraphCxx/include/OpenAttributeGraphCxx/Graph/Graph.hpp index 37dbc0d8..10c8c45a 100644 --- a/Sources/OpenAttributeGraphCxx/include/OpenAttributeGraphCxx/Graph/Graph.hpp +++ b/Sources/OpenAttributeGraphCxx/include/OpenAttributeGraphCxx/Graph/Graph.hpp @@ -116,6 +116,8 @@ class Graph final { const void value_mark_all() const OAG_NOEXCEPT; + static void trace_assertion_failure(bool, const char *, ...) OAG_NOEXCEPT; + static void all_start_profiling(uint32_t) OAG_NOEXCEPT; static void all_stop_profiling() OAG_NOEXCEPT; void start_profiling(uint32_t) OAG_NOEXCEPT; From be46a7ae035884effa505705cc3cf913795cdbd8 Mon Sep 17 00:00:00 2001 From: Kyle Date: Fri, 27 Feb 2026 00:56:45 +0800 Subject: [PATCH 2/2] Fix duplicate symbol error by making error_message static Use internal linkage for error_message to avoid linker collision when both OpenAttributeGraph and OpenRenderBox are linked together. --- Sources/OpenAttributeGraphCxx/Misc/assert.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/OpenAttributeGraphCxx/Misc/assert.cpp b/Sources/OpenAttributeGraphCxx/Misc/assert.cpp index 483221e5..5c4450cf 100644 --- a/Sources/OpenAttributeGraphCxx/Misc/assert.cpp +++ b/Sources/OpenAttributeGraphCxx/Misc/assert.cpp @@ -9,7 +9,7 @@ #include #include -char* error_message = nullptr; +static char* error_message = nullptr; namespace OAG { void precondition_failure(const char *format, ...) {