MCPcopy Create free account
hub / github.com/NeuralNetworkVerification/Marabou / construct

Method construct

deps/CVC4/base/check.cpp:44–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42}
43
44void AssertArgumentException::construct(const char* header,
45 const char* extra,
46 const char* function,
47 const char* file,
48 unsigned line,
49 const char* fmt,
50 va_list args)
51{
52 // try building the exception msg with a smallish buffer first,
53 // then with a larger one if sprintf tells us to.
54 int n = 512;
55 char* buf;
56 buf = new char[n];
57
58 for (;;)
59 {
60 int size;
61 if (extra == NULL)
62 {
63 size = snprintf(buf, n, "%s\n%s\n%s:%d\n", header, function, file, line);
64 }
65 else
66 {
67 size = snprintf(buf,
68 n,
69 "%s\n%s\n%s:%d:\n\n %s\n",
70 header,
71 function,
72 file,
73 line,
74 extra);
75 }
76
77 if (size < n)
78 {
79 va_list args_copy;
80 va_copy(args_copy, args);
81 size += vsnprintf(buf + size, n - size, fmt, args_copy);
82 va_end(args_copy);
83
84 if (size < n)
85 {
86 break;
87 }
88 }
89
90 if (size >= n)
91 {
92 // try again with a buffer that's large enough
93 n = size + 1;
94 delete[] buf;
95 buf = new char[n];
96 }
97 }
98
99 setMessage(std::string(buf));
100
101#ifdef CVC4_DEBUG

Callers

nothing calls this directly

Calls 3

setMessageFunction · 0.85
getCurrentFunction · 0.85
setContentsMethod · 0.80

Tested by

no test coverage detected