diff options
author | Shoaib Meenai <smeenai@fb.com> | 2016-10-31 15:09:10 +0000 |
---|---|---|
committer | Shoaib Meenai <smeenai@fb.com> | 2016-10-31 15:09:10 +0000 |
commit | 3b2cf9659df072841bc775efc61ec5819d9e5aae (patch) | |
tree | 24ffe551dccb8f5ab6e46629c6f695e8aed54e76 | |
parent | 1c0757acd13533851ae794f2c24d12a7f01d06ba (diff) |
[libc++] Add configuration define for off_t functions
Create this define in __config and use it elsewhere, instead of checking
the operating system/library defines in other files. The aim is to
reduce the usage of _WIN32 outside __config. No functional change.
Differential Revision: https://reviews.llvm.org/D25741
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@285582 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/__config | 6 | ||||
-rw-r--r-- | include/fstream | 6 |
2 files changed, 9 insertions, 3 deletions
diff --git a/include/__config b/include/__config index 572b01520..cd8c2aa61 100644 --- a/include/__config +++ b/include/__config @@ -904,6 +904,12 @@ extern "C" void __sanitizer_annotate_contiguous_container( #define _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF #endif +#if !defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS) +#if defined(_WIN32) || defined(_NEWLIB_VERSION) +#define _LIBCPP_HAS_NO_OFF_T_FUNCTIONS +#endif +#endif + #endif // __cplusplus #endif // _LIBCPP_CONFIG diff --git a/include/fstream b/include/fstream index ce13b31c8..b8d18aadb 100644 --- a/include/fstream +++ b/include/fstream @@ -813,7 +813,7 @@ basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way, default: return pos_type(off_type(-1)); } -#if defined(_WIN32) || defined(_NEWLIB_VERSION) +#if defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS) if (fseek(__file_, __width > 0 ? __width * __off : 0, __whence)) return pos_type(off_type(-1)); pos_type __r = ftell(__file_); @@ -832,7 +832,7 @@ basic_filebuf<_CharT, _Traits>::seekpos(pos_type __sp, ios_base::openmode) { if (__file_ == 0 || sync()) return pos_type(off_type(-1)); -#if defined(_WIN32) || defined(_NEWLIB_VERSION) +#if defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS) if (fseek(__file_, __sp, SEEK_SET)) return pos_type(off_type(-1)); #else @@ -896,7 +896,7 @@ basic_filebuf<_CharT, _Traits>::sync() } } } -#if defined(_WIN32) || defined(_NEWLIB_VERSION) +#if defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS) if (fseek(__file_, -__c, SEEK_CUR)) return -1; #else |