Fix a fatal Clang warning on Linux

Two fromstrerror_helper overloads are defined, to manage the fact that
strerror_r returns an int or a char* depending on the system. The problem
is that then only one overload used (again, depending on the actual
stderror_r return type), leading to one of the two overload to be unused
and thus triggering the unused function warning.

kernel/qsystemerror.cpp:64:27: error: unused function 'fromstrerror_helper' [-Werror,-Wunused-function]
    static inline QString fromstrerror_helper(int, const QByteArray &buf)

Change-Id: I6a1c8e1a4b7d14068b682db26002ff68ad36167c
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
This commit is contained in:
Giuseppe D'Angelo 2014-11-03 17:18:55 +01:00
parent c4cfe9091e
commit eab4bd5cee

View File

@ -61,11 +61,11 @@ namespace {
// version in portable code. However, it's impossible to do that if
// _GNU_SOURCE is defined so we use C++ overloading to decide what to do
// depending on the return type
static inline QString fromstrerror_helper(int, const QByteArray &buf)
static inline Q_DECL_UNUSED QString fromstrerror_helper(int, const QByteArray &buf)
{
return QString::fromLocal8Bit(buf);
}
static inline QString fromstrerror_helper(const char *str, const QByteArray &)
static inline Q_DECL_UNUSED QString fromstrerror_helper(const char *str, const QByteArray &)
{
return QString::fromLocal8Bit(str);
}