Kaydet (Commit) 514db965 authored tarafından Caolán McNamara's avatar Caolán McNamara

coverity#1438473 silence Logically dead code

Change-Id: I10b3821311515bb5148dab698f07d902c5c73100
Reviewed-on: https://gerrit.libreoffice.org/59822
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 239e6547
......@@ -184,6 +184,29 @@ struct ConstCharArrayDetector< const char[ N ], T >
#endif
static char const * toPointer(char const (& literal)[N]) { return literal; }
};
#if defined(__COVERITY__)
//to silence over zealous warnings that the loop is logically dead
//for the single char case
template< typename T >
struct ConstCharArrayDetector< const char[ 1 ], T >
{
typedef T Type;
static const std::size_t length = 0;
static const bool ok = true;
#if defined LIBO_INTERNAL_ONLY && HAVE_CXX14_CONSTEXPR
constexpr
#endif
static bool isValid(char const (& literal)[1]) {
return literal[0] == '\0';
}
#if defined LIBO_INTERNAL_ONLY
constexpr
#endif
static char const * toPointer(char const (& literal)[1]) { return literal; }
};
#endif
#if defined LIBO_INTERNAL_ONLY
template<std::size_t N, typename T>
struct ConstCharArrayDetector<sal_Unicode const [N], T> {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment