Skip to content

Commit 1f802e4

Browse files
thorsten-kleinkris-jusiak
authored andcommitted
fixed review finding
1 parent 77cc9fc commit 1f802e4

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

include/GUnit/Detail/TypeTraits.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,28 +154,30 @@ auto get_type_name_impl(const char *ptr, std::index_sequence<Ns...>) {
154154
return str;
155155
}
156156

157+
158+
#if defined(__clang__)
157159
constexpr bool const_strncmp(const char* a, const char*b, uint8_t n)
158160
{
159-
bool retval = 1;
160-
161+
bool retval = false;
161162
for(uint8_t i = 0; i<n; i++)
162163
{
163164
if(a[i] != b[i])
164165
{
165-
retval = 0;
166+
retval = true;
166167
break;
167168
}
168169
}
169170
return retval;
170171
}
172+
#endif
171173

172174
template <class T>
173175
const char *get_type_name() {
174176

175177
#if defined(__clang__)
176178
constexpr char opt1[] = "const char *testing::v1::detail::get_type_name() [T = ";
177179
constexpr char opt2[] = "const char *testing::detail::get_type_name() [T = ";
178-
constexpr uint16_t offset = const_strncmp(__PRETTY_FUNCTION__, opt1, sizeof(opt1)-1)? sizeof(opt1)-1 : sizeof(opt2)-1;
180+
constexpr uint16_t offset = const_strncmp(__PRETTY_FUNCTION__, opt1, sizeof(opt1)-1)? sizeof(opt2)-1 : sizeof(opt1)-1;
179181
#elif defined(__GNUC__)
180182
constexpr uint16_t offset = sizeof("const char* testing::v1::detail::get_type_name() [with T = ") - 1;
181183
#endif

0 commit comments

Comments
 (0)