Skip to content

Commit baf1fcd

Browse files
committed
verification asserts removed
1 parent 39076ee commit baf1fcd

File tree

1 file changed

+12
-22
lines changed

1 file changed

+12
-22
lines changed

unified-runtime/source/common/logger/ur_sinks.hpp

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include "ur_filesystem_resolved.hpp"
1616
#include "ur_level.hpp"
1717
#include "ur_print.hpp"
18-
#include <assert.h>
1918

2019
namespace logger {
2120

@@ -91,7 +90,8 @@ class Sink {
9190
std::mutex output_mutex;
9291
const char *error_prefix = "Log message syntax error: ";
9392

94-
void format(std::ostringstream &buffer, const char *filename, const char *lineno, const char *fmt) {
93+
void format(std::ostringstream &buffer, const char *filename,
94+
const char *lineno, const char *fmt) {
9595
while (*fmt != '\0') {
9696
while (*fmt != '{' && *fmt != '}' && *fmt != '\0') {
9797
buffer << *fmt++;
@@ -101,28 +101,24 @@ class Sink {
101101
if (*(++fmt) == '{') {
102102
buffer << *fmt++;
103103
} else {
104-
std::cerr << error_prefix
105-
<< "No arguments provided and braces not escaped!"
106-
<< filename << ":" << lineno
107-
<< std::endl;
108-
assert(false && "No arguments provided and braces not escaped!");
104+
std::cerr << error_prefix
105+
<< "No arguments provided and braces not escaped!"
106+
<< filename << ":" << lineno << std::endl;
109107
}
110108
} else if (*fmt == '}') {
111109
if (*(++fmt) == '}') {
112110
buffer << *fmt++;
113111
} else {
114-
std::cerr << error_prefix << "Closing curly brace not escaped!"
115-
<< filename << ":" << lineno
116-
<< std::endl;
117-
assert(false);
112+
std::cerr << error_prefix << "Closing curly brace not escaped!"
113+
<< filename << ":" << lineno << std::endl;
118114
}
119115
}
120116
}
121117
}
122118

123119
template <typename Arg, typename... Args>
124-
void format(std::ostringstream &buffer, const char *filename, const char *lineno, const char *fmt, Arg &&arg,
125-
Args &&...args) {
120+
void format(std::ostringstream &buffer, const char *filename,
121+
const char *lineno, const char *fmt, Arg &&arg, Args &&...args) {
126122
bool arg_printed = false;
127123
while (!arg_printed) {
128124
while (*fmt != '{' && *fmt != '}' && *fmt != '\0') {
@@ -134,9 +130,7 @@ class Sink {
134130
buffer << *fmt++;
135131
} else if (*fmt != '}') {
136132
std::cerr << error_prefix << "Only empty braces are allowed!"
137-
<< filename << ":" << lineno
138-
<< std::endl;
139-
assert(false);
133+
<< filename << ":" << lineno << std::endl;
140134
} else {
141135
buffer << arg;
142136
arg_printed = true;
@@ -146,18 +140,14 @@ class Sink {
146140
buffer << *fmt++;
147141
} else {
148142
std::cerr << error_prefix << "Closing curly brace not escaped!"
149-
<< filename << ":" << lineno
150-
<< std::endl;
151-
assert(false);
143+
<< filename << ":" << lineno << std::endl;
152144
}
153145
}
154146

155147
if (*fmt == '\0') {
156-
std::cerr << error_prefix
157-
<< filename << ":" << lineno
148+
std::cerr << error_prefix << filename << ":" << lineno
158149
<< "Too many arguments! first excessive:" << arg << std::endl;
159150
// ignore all left arguments and finalize message
160-
assert(false);
161151
format(buffer, filename, lineno, fmt);
162152
return;
163153
}

0 commit comments

Comments
 (0)