mclow.lists added inline comments.
================ Comment at: include/__string:213 - static inline int compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT - {return __n == 0 ? 0 : memcmp(__s1, __s2, __n);} - static inline size_t length(const char_type* __s) _NOEXCEPT {return strlen(__s);} - static inline const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT - {return __n == 0 ? NULL : (const char_type*) memchr(__s, to_int_type(__a), __n);} +#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR) + static inline constexpr int ---------------- AntonBikineev wrote: > EricWF wrote: > > wow. This is #ifdef hell. Please find a way to do it with less (or > > hopefully no) conditional compilation blocks. > yep, this is generic hell. I want to cover as many cases as possible, i.e. > combinations of (is_constexpr x has_builtin_xxx) for every function. I'm open > to suggestions How about (for compare, say) you just forget about `memcmp`. Either call `__builtin_memcmp` if it is available, or use a hand-rolled loop. Note: gcc has had `__builtin_memcmp` since at least 4.8. (and it is constexpr) And just mark the function with `_LIBCPP_CONSTEXPR_AFTER_CXX14`. https://reviews.llvm.org/D26896 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits