Commit 1702a53f authored by Rosen Penev's avatar Rosen Penev Committed by Facebook Github Bot

constexpr: Use GLIBCXX instead of GNUC (#1288)

Summary:
libcxx does not have strcmp or strlen as constexpr.
Signed-off-by: default avatarRosen Penev <rosenp@gmail.com>
Pull Request resolved: https://github.com/facebook/folly/pull/1288

Reviewed By: Orvid

Differential Revision: D19226813

Pulled By: yfeldblum

fbshipit-source-id: 4b5de4f923f4d7871c059af54eb7d375f344f48a
parent 80031642
...@@ -63,7 +63,7 @@ constexpr size_t constexpr_strlen(const char* s) { ...@@ -63,7 +63,7 @@ constexpr size_t constexpr_strlen(const char* s) {
#if FOLLY_HAS_FEATURE(cxx_constexpr_string_builtins) #if FOLLY_HAS_FEATURE(cxx_constexpr_string_builtins)
// clang provides a constexpr builtin // clang provides a constexpr builtin
return __builtin_strlen(s); return __builtin_strlen(s);
#elif defined(__GNUC__) && !defined(__clang__) #elif defined(__GLIBCXX__) && !defined(__clang__)
// strlen() happens to already be constexpr under gcc // strlen() happens to already be constexpr under gcc
return std::strlen(s); return std::strlen(s);
#else #else
...@@ -81,7 +81,7 @@ constexpr int constexpr_strcmp(const char* s1, const char* s2) { ...@@ -81,7 +81,7 @@ constexpr int constexpr_strcmp(const char* s1, const char* s2) {
#if FOLLY_HAS_FEATURE(cxx_constexpr_string_builtins) #if FOLLY_HAS_FEATURE(cxx_constexpr_string_builtins)
// clang provides a constexpr builtin // clang provides a constexpr builtin
return __builtin_strcmp(s1, s2); return __builtin_strcmp(s1, s2);
#elif defined(__GNUC__) && !defined(__clang__) #elif defined(__GLIBCXX__) && !defined(__clang__)
// strcmp() happens to already be constexpr under gcc // strcmp() happens to already be constexpr under gcc
return std::strcmp(s1, s2); return std::strcmp(s1, s2);
#else #else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment