[PATCH] D25741: [libc++] Add configuration define for off_t functions
Shoaib Meenai via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 18 11:24:27 PDT 2016
smeenai created this revision.
smeenai added reviewers: EricWF, mclow.lists.
smeenai added a subscriber: cfe-commits.
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.
https://reviews.llvm.org/D25741
Files:
include/__config
include/fstream
Index: include/fstream
===================================================================
--- include/fstream
+++ include/fstream
@@ -813,7 +813,7 @@
default:
return pos_type(off_type(-1));
}
-#if defined(_WIN32) || defined(_NEWLIB_VERSION)
+#if !defined(_LIBCPP_HAS_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 @@
{
if (__file_ == 0 || sync())
return pos_type(off_type(-1));
-#if defined(_WIN32) || defined(_NEWLIB_VERSION)
+#if !defined(_LIBCPP_HAS_OFF_T_FUNCTIONS)
if (fseek(__file_, __sp, SEEK_SET))
return pos_type(off_type(-1));
#else
@@ -896,7 +896,7 @@
}
}
}
-#if defined(_WIN32) || defined(_NEWLIB_VERSION)
+#if !defined(_LIBCPP_HAS_OFF_T_FUNCTIONS)
if (fseek(__file_, -__c, SEEK_CUR))
return -1;
#else
Index: include/__config
===================================================================
--- include/__config
+++ include/__config
@@ -908,6 +908,12 @@
#define _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
#endif
+#if !defined(_LIBCPP_HAS_OFF_T_FUNCTIONS)
+#if !(defined(_WIN32) || defined(_NEWLIB_VERSION))
+#define _LIBCPP_HAS_OFF_T_FUNCTIONS
+#endif
+#endif
+
#endif // __cplusplus
#endif // _LIBCPP_CONFIG
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25741.75051.patch
Type: text/x-patch
Size: 1367 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161018/37082e5b/attachment.bin>
More information about the cfe-commits
mailing list