Merge pull request #423 from coreyfarrell/gcc-8
Deal with warnings under gcc 8.
This commit is contained in:
commit
37147b8a23
@ -108,7 +108,14 @@ AC_DEFINE_UNQUOTED([INITIAL_HASHTABLE_ORDER], [$initial_hashtable_order],
|
|||||||
[Number of buckets new object hashtables contain is 2 raised to this power. E.g. 3 -> 2^3 = 8.])
|
[Number of buckets new object hashtables contain is 2 raised to this power. E.g. 3 -> 2^3 = 8.])
|
||||||
|
|
||||||
if test x$GCC = xyes; then
|
if test x$GCC = xyes; then
|
||||||
AM_CFLAGS="-Wall -Wextra -Wdeclaration-after-statement"
|
AC_MSG_CHECKING(for -Wno-format-truncation)
|
||||||
|
wnoformat_truncation="-Wno-format-truncation"
|
||||||
|
AS_IF([${CC} -Wno-format-truncation -Werror -S -o /dev/null -xc /dev/null > /dev/null 2>&1],
|
||||||
|
[AC_MSG_RESULT(yes)],
|
||||||
|
[AC_MSG_RESULT(no)
|
||||||
|
wnoformat_truncation=""])
|
||||||
|
|
||||||
|
AM_CFLAGS="-Wall -Wextra -Wdeclaration-after-statement ${wnoformat_truncation}"
|
||||||
fi
|
fi
|
||||||
AC_SUBST([AM_CFLAGS])
|
AC_SUBST([AM_CFLAGS])
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ void jsonp_error_set_source(json_error_t *error, const char *source)
|
|||||||
strncpy(error->source, source, length + 1);
|
strncpy(error->source, source, length + 1);
|
||||||
else {
|
else {
|
||||||
size_t extra = length - JSON_ERROR_SOURCE_LENGTH + 4;
|
size_t extra = length - JSON_ERROR_SOURCE_LENGTH + 4;
|
||||||
strncpy(error->source, "...", 3);
|
memcpy(error->source, "...", 3);
|
||||||
strncpy(error->source + 3, source + extra, length - extra + 1);
|
strncpy(error->source + 3, source + extra, length - extra + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user