Skip to content

Commit 2682d4b

Browse files
authored
Add Graph::trace_assertion_failure and fix duplicate error_message symbol (#220)
1 parent 9b0ce6c commit 2682d4b

3 files changed

Lines changed: 13 additions & 5 deletions

File tree

‎Sources/OpenAttributeGraphCxx/Graph/OAGGraphTracing.cpp‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
// OpenAttributeGraphCxx
44

55
#include <OpenAttributeGraph/OAGGraphTracing.h>
6+
#include <OpenAttributeGraphCxx/Graph/Graph.hpp>
7+
8+
namespace OAG {
9+
void Graph::trace_assertion_failure(bool remove, const char *format, ...) OAG_NOEXCEPT {
10+
// TODO
11+
}
12+
} /* OAG */
613

714
void OAGGraphStartTracing(_Nullable OAGGraphRef graph, OAGGraphTraceOptions options) {
815
OAGGraphStartTracing2(graph, options, NULL);

‎Sources/OpenAttributeGraphCxx/Misc/assert.cpp‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44

55
#include <OpenAttributeGraphCxx/Misc/assert.hpp>
66
#include <OpenAttributeGraphCxx/Misc/log.hpp>
7+
#include <OpenAttributeGraphCxx/Graph/Graph.hpp>
78

89
#include <stdio.h>
910
#include <stdlib.h>
1011

11-
char* error_message = nullptr;
12+
static char* error_message = nullptr;
1213

1314
namespace OAG {
1415
void precondition_failure(const char *format, ...) {
@@ -19,9 +20,7 @@ void precondition_failure(const char *format, ...) {
1920
va_end(va);
2021
if (s != nullptr) {
2122
platform_log_error(error_log(), "precondition failure: %s", s);
22-
#if OAG_TARGET_RELEASE >= OAG_RELEASE_2023
23-
// OAG::Graph::trace_assertion_failure(true, "precondition failure: %s", s)
24-
#endif
23+
Graph::trace_assertion_failure(true, "precondition failure: %s", s);
2524
if (error_message == nullptr) {
2625
asprintf(&error_message, "OpenAttributeGraph precondition failure: %s.\n", s);
2726
}
@@ -38,8 +37,8 @@ void non_fatal_precondition_failure(const char *format, ...) {
3837
va_end(va);
3938
if (s != nullptr) {
4039
platform_log_fault(error_log(), "precondition failure: %s", s);
40+
Graph::trace_assertion_failure(false, "precondition failure: %s", s);
4141
free(s);
4242
}
43-
return;
4443
}
4544
} /* OAG */

‎Sources/OpenAttributeGraphCxx/include/OpenAttributeGraphCxx/Graph/Graph.hpp‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ class Graph final {
116116

117117
const void value_mark_all() const OAG_NOEXCEPT;
118118

119+
static void trace_assertion_failure(bool, const char *, ...) OAG_NOEXCEPT;
120+
119121
static void all_start_profiling(uint32_t) OAG_NOEXCEPT;
120122
static void all_stop_profiling() OAG_NOEXCEPT;
121123
void start_profiling(uint32_t) OAG_NOEXCEPT;

0 commit comments

Comments
 (0)