[libcxx] r285582 - [libc++] Add configuration define for off_t functions

Shoaib Meenai via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 31 08:09:10 PDT 2016


Author: smeenai
Date: Mon Oct 31 10:09:10 2016
New Revision: 285582

URL: http://llvm.org/viewvc/llvm-project?rev=285582&view=rev
Log:
[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

Modified:
    libcxx/trunk/include/__config
    libcxx/trunk/include/fstream

Modified: libcxx/trunk/include/__config
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=285582&r1=285581&r2=285582&view=diff
==============================================================================
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Mon Oct 31 10:09:10 2016
@@ -904,6 +904,12 @@ extern "C" void __sanitizer_annotate_con
 #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

Modified: libcxx/trunk/include/fstream
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/fstream?rev=285582&r1=285581&r2=285582&view=diff
==============================================================================
--- libcxx/trunk/include/fstream (original)
+++ libcxx/trunk/include/fstream Mon Oct 31 10:09:10 2016
@@ -813,7 +813,7 @@ basic_filebuf<_CharT, _Traits>::seekoff(
     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(
 {
     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




More information about the cfe-commits mailing list