Skip to content

Commit

Permalink
Enable diagnose_if compile-time wrong dmax warnings
Browse files Browse the repository at this point in the history
sizeof(dest)!=dmax checks as user-defined warnings (clang).
when __builtin_object_size returns the known object size.
See GH #40

e.g.:
test_strcoll_s.c:81:39: warning: wrong dmax [-Wuser-defined-warnings]
    rc = strcoll_s(str1, 0, str2, &ind);
  • Loading branch information
rurban committed Feb 6, 2018
1 parent c86bd9e commit d880e30
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 65 deletions.
9 changes: 8 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ ax_cv_check_ldflags___Wl__fatal_warnings=no
dnl sprintf_s passing through to vsnprintf_s
ax_cv_check_cflags__Wformat_2=no
ax_cv_check_cflags__Wformat_nonliteral=no
ax_cv_check_cflags__Wgcc_compat=no
dnl windows mult. decl are not properly sorted out yet
dnl const -Wdiscarded-qualifiers is stricter on mingw
case $host_os in
Expand Down Expand Up @@ -443,6 +444,11 @@ case $host_os in
# AM_LDFLAGS=`echo $AM_LDFLAGS|sed -e"s/-Wl,--as-needed -Wl,--no-as-needed//"`
;;
esac
dnl against -Werror,-Wgcc-compat
case $WARN_CFLAGS in
*-Wformat-security*)
WARN_CFLAGS="$WARN_CFLAGS -Wno-gcc-compat -Wno-error=user-defined-warnings" ;;
esac

dnl Was needed for wcsnorm_s / mark.h. So far not needed anymore
dnl AX_CHECK_COMPILE_FLAG([-fbracket-depth=512],
Expand Down Expand Up @@ -574,6 +580,8 @@ AC_CHECK_MEMBER(struct tm.tm_gmtoff,
[#include <time.h>])
AX_COMPILE_CHECK_SIZEOF(time_t, [#include <time.h>])
AC_CHECK_TYPE([wchar_t],[],[],[[#include <wchar.h>]])
AX_GCC_BUILTIN(__builtin_ctz)
AX_GCC_BUILTIN(__builtin_object_size)

AC_MSG_NOTICE([Check library functions])
# ===============================================
Expand Down Expand Up @@ -601,7 +609,6 @@ AC_CHECK_FUNCS([memset strcmp strcasecmp strcasestr strcspn strpbrk strspn \
vsscanf_s vscanf_s printf_s fprintf_s tmpfile_s vfprintf_s vprintf_s \
fopen_s freopen_s gets_s bsearch_s qsort_s gmtime_s localtime_s \
asctime_s ctime_s getenv_s ])
AX_GCC_BUILTIN(__builtin_ctz)
AM_CONDITIONAL([HAVE_WCSSTR], [test "x$ac_cv_func_wcsstr" = "xyes"])
AM_CONDITIONAL([HAVE_MBSTOWCS], [test "x$ac_cv_func_mbstowcs" = "xyes"])
AM_CONDITIONAL([HAVE_MEMCPY_S], [test "x$ac_cv_func_memcpy_s" = "xyes"])
Expand Down
Loading

0 comments on commit d880e30

Please sign in to comment.