git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120826
91177308-0d34-0410-b5e6-
96231b3b80d8
check_symbol_exists(strerror_r string.h HAVE_STRERROR_R)
check_symbol_exists(strerror_s string.h HAVE_STRERROR_S)
check_symbol_exists(setenv stdlib.h HAVE_SETENV)
+if ( LLVM_ON_WIN32 )
+ check_symbol_exists(_chsize_s io.h HAVE__CHSIZE_S)
+endif()
check_symbol_exists(__GLIBC__ stdio.h LLVM_USING_GLIBC)
if( LLVM_USING_GLIBC )
/* Define to 1 if you have the `setenv' function. */
#cmakedefine HAVE_SETENV ${HAVE_SETENV}
+/* Define to 1 if you have the `_chsize_s' function. */
+#cmakedefine HAVE__CHSIZE_S ${HAVE__CHSIZE_S}
+
/* Define to 1 if you have the `setjmp' function. */
#undef HAVE_SETJMP
int fd = ::_wopen(path_utf16.begin(), O_BINARY, S_IREAD | S_IWRITE);
if (fd == -1)
return error_code(errno, generic_category());
+#ifdef HAVE__CHSIZE_S
errno_t error = ::_chsize_s(fd, size);
+#else
+ errno_t error = ::_chsize(fd, size);
+#endif
::close(fd);
return error_code(error, generic_category());
}