[safe_op] Fix ODR violation in compiler builtin specializations

The compiler instrinsics are exposed via fully specialized template functions
which must not be defined twice (which they accidentally were). Declaring them
as inline fixes this issue.
v0.27.3
Dan Čermák 7 years ago
parent 943ba1773e
commit bf51a76e4e

@ -1,6 +1,6 @@
// ********************************************************* -*- C++ -*-
/*
* Copyright (C) 2004-2017 Exiv2 maintainers
* Copyright (C) 2004-2018 Exiv2 maintainers
*
* This program is part of the Exiv2 distribution.
*
@ -222,7 +222,7 @@ namespace Safe
/* Full specialization of builtin_add_overflow for type using the */ \
/* builtin_name intrinsic */ \
template <> \
bool builtin_add_overflow<type>(type summand_1, type summand_2, type & result) \
inline bool builtin_add_overflow<type>(type summand_1, type summand_2, type & result) \
{ \
return builtin_name(summand_1, summand_2, &result); \
}
@ -257,7 +257,7 @@ namespace Safe
*/
#define SPECIALIZE_builtin_add_overflow_WIN(type, builtin_name) \
template <> \
bool builtin_add_overflow(type summand_1, type summand_2, type& result) \
inline bool builtin_add_overflow(type summand_1, type summand_2, type& result) \
{ \
return builtin_name(summand_1, summand_2, &result) != S_OK; \
}

Loading…
Cancel
Save