mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 20:23:11 +01:00
lib/Support/Errno.cpp: Check strerror_s() with HAVE_DECL_STRERROR_S in config.h.*.
AC_CHECK_FUNCS seeks a symbol only in libs. We should check the declaration in string.h. FIXME: I have never seen mingw(s) have strerror_s() (not _strerror_s()). FIXME: Autoconf/CMake may seek strerror_s() with the definition MINGW_HAS_SECURE_API in future. llvm-svn: 125172
This commit is contained in:
parent
26a6cce27e
commit
55dd89bf51
@ -1391,12 +1391,15 @@ AC_CHECK_FUNCS([powf fmodf strtof round ])
|
||||
AC_CHECK_FUNCS([getpagesize getrusage getrlimit setrlimit gettimeofday ])
|
||||
AC_CHECK_FUNCS([isatty mkdtemp mkstemp ])
|
||||
AC_CHECK_FUNCS([mktemp posix_spawn realpath sbrk setrlimit strdup ])
|
||||
AC_CHECK_FUNCS([strerror strerror_r strerror_s setenv ])
|
||||
AC_CHECK_FUNCS([strerror strerror_r setenv ])
|
||||
AC_CHECK_FUNCS([strtoll strtoq sysconf malloc_zone_statistics ])
|
||||
AC_CHECK_FUNCS([setjmp longjmp sigsetjmp siglongjmp writev])
|
||||
AC_C_PRINTF_A
|
||||
AC_FUNC_RAND48
|
||||
|
||||
dnl Check the declaration "Secure API" on Windows environments.
|
||||
AC_CHECK_DECLS([strerror_s])
|
||||
|
||||
dnl Check symbols in libgcc.a for JIT on Mingw.
|
||||
if test "$llvm_cv_os_type" = "MingW" ; then
|
||||
AC_CHECK_LIB(gcc,_alloca,AC_DEFINE([HAVE__ALLOCA],[1],[Have host's _alloca]))
|
||||
|
@ -149,7 +149,7 @@ check_symbol_exists(strtoll stdlib.h HAVE_STRTOLL)
|
||||
check_symbol_exists(strtoq stdlib.h HAVE_STRTOQ)
|
||||
check_symbol_exists(strerror string.h HAVE_STRERROR)
|
||||
check_symbol_exists(strerror_r string.h HAVE_STRERROR_R)
|
||||
check_symbol_exists(strerror_s string.h HAVE_STRERROR_S)
|
||||
check_symbol_exists(strerror_s string.h HAVE_DECL_STRERROR_S)
|
||||
check_symbol_exists(memcpy string.h HAVE_MEMCPY)
|
||||
check_symbol_exists(memmove string.h HAVE_MEMMOVE)
|
||||
check_symbol_exists(setenv stdlib.h HAVE_SETENV)
|
||||
|
90
configure
vendored
90
configure
vendored
@ -18679,8 +18679,7 @@ done
|
||||
|
||||
|
||||
|
||||
|
||||
for ac_func in strerror strerror_r strerror_s setenv
|
||||
for ac_func in strerror strerror_r setenv
|
||||
do
|
||||
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||
{ echo "$as_me:$LINENO: checking for $ac_func" >&5
|
||||
@ -19199,6 +19198,93 @@ _ACEOF
|
||||
fi
|
||||
|
||||
|
||||
{ echo "$as_me:$LINENO: checking whether strerror_s is declared" >&5
|
||||
echo $ECHO_N "checking whether strerror_s is declared... $ECHO_C" >&6; }
|
||||
if test "${ac_cv_have_decl_strerror_s+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
$ac_includes_default
|
||||
int
|
||||
main ()
|
||||
{
|
||||
#ifndef strerror_s
|
||||
char *p = (char *) strerror_s;
|
||||
return !p;
|
||||
#endif
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (ac_try="$ac_compile"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
|
||||
(eval "$ac_compile") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
|
||||
{ (case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
|
||||
(eval "$ac_try") 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; } &&
|
||||
{ ac_try='test -s conftest.$ac_objext'
|
||||
{ (case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
|
||||
(eval "$ac_try") 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
ac_cv_have_decl_strerror_s=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_cv_have_decl_strerror_s=no
|
||||
fi
|
||||
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_strerror_s" >&5
|
||||
echo "${ECHO_T}$ac_cv_have_decl_strerror_s" >&6; }
|
||||
if test $ac_cv_have_decl_strerror_s = yes; then
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_DECL_STRERROR_S 1
|
||||
_ACEOF
|
||||
|
||||
|
||||
else
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_DECL_STRERROR_S 0
|
||||
_ACEOF
|
||||
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if test "$llvm_cv_os_type" = "MingW" ; then
|
||||
{ echo "$as_me:$LINENO: checking for _alloca in -lgcc" >&5
|
||||
echo $ECHO_N "checking for _alloca in -lgcc... $ECHO_C" >&6; }
|
||||
|
@ -62,6 +62,10 @@
|
||||
/* Define to 1 if you have the <ctype.h> header file. */
|
||||
#cmakedefine HAVE_CTYPE_H ${HAVE_CTYPE_H}
|
||||
|
||||
/* Define to 1 if you have the declaration of `strerror_s', and to 0 if you
|
||||
don't. */
|
||||
#cmakedefine01 HAVE_DECL_STRERROR_S
|
||||
|
||||
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
|
||||
*/
|
||||
#cmakedefine HAVE_DIRENT_H ${HAVE_DIRENT_H}
|
||||
@ -368,9 +372,6 @@
|
||||
/* Define to 1 if you have the `strerror_r' function. */
|
||||
#cmakedefine HAVE_STRERROR_R ${HAVE_STRERROR_R}
|
||||
|
||||
/* Define to 1 if you have the `strerror_s' function. */
|
||||
#cmakedefine HAVE_STRERROR_S ${HAVE_STRERROR_S}
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#cmakedefine HAVE_STRINGS_H ${HAVE_STRINGS_H}
|
||||
|
||||
|
@ -78,6 +78,10 @@
|
||||
/* Define to 1 if you have the <ctype.h> header file. */
|
||||
#undef HAVE_CTYPE_H
|
||||
|
||||
/* Define to 1 if you have the declaration of `strerror_s', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_STRERROR_S
|
||||
|
||||
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
|
||||
*/
|
||||
#undef HAVE_DIRENT_H
|
||||
@ -384,9 +388,6 @@
|
||||
/* Define to 1 if you have the `strerror_r' function. */
|
||||
#undef HAVE_STRERROR_R
|
||||
|
||||
/* Define to 1 if you have the `strerror_s' function. */
|
||||
#undef HAVE_STRERROR_S
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
|
@ -50,7 +50,7 @@ std::string StrError(int errnum) {
|
||||
# else
|
||||
strerror_r(errnum,buffer,MaxErrStrLen-1);
|
||||
# endif
|
||||
#elif defined(HAVE_STRERROR_S) // Windows.
|
||||
#elif HAVE_DECL_STRERROR_S // "Windows Secure API"
|
||||
if (errnum)
|
||||
strerror_s(buffer, errnum);
|
||||
#elif defined(HAVE_STRERROR)
|
||||
|
Loading…
Reference in New Issue
Block a user