Commit a1d0f15a authored by Eric Niebler's avatar Eric Niebler Committed by Facebook Github Bot

don't try to run the poly tests on gcc-4.9. they will fail.

Summary: gcc-4.9 does not support features that Poly needs. Disable the tests on that platform.

Reviewed By: meyering

Differential Revision: D6211674

fbshipit-source-id: 289f029122a45b0f9ec740c62b1faaafb51dcab5
parent 8b37be00
......@@ -571,7 +571,6 @@ libfolly_la_SOURCES = \
detail/SocketFastOpen.cpp \
MacAddress.cpp \
memory/ThreadCachedArena.cpp \
Poly.cpp \
portability/Dirent.cpp \
portability/Fcntl.cpp \
portability/Libgen.cpp \
......@@ -713,6 +712,11 @@ libfolly_la_SOURCES += \
experimental/symbolizer/Symbolizer.cpp
endif
if HAVE_VARIABLE_TEMPLATES
libfolly_la_SOURCES += \
Poly.cpp
endif
libfollybasesse42_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(LT_VERSION)
libfollybasesse42_la_CXXFLAGS = -msse4.2 -mpclmul
......
......@@ -14,6 +14,10 @@
* limitations under the License.
*/
#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ < 5
#pragma message "Folly.Poly requires gcc-5 or greater"
#else
#include <folly/Poly.h>
namespace folly {
......@@ -22,3 +26,5 @@ namespace detail {
[[noreturn]] void throwBadPolyCast() { throw BadPolyCast(); }
} // namespace detail
} // namespace folly
#endif
......@@ -25,6 +25,10 @@
#pragma once
#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ < 5
#error Folly.Poly requires gcc-5 or greater
#endif
#include <cassert>
#include <new>
#include <type_traits>
......
......@@ -525,6 +525,22 @@ AC_DEFINE_UNQUOTED(
[Define to 1 if the compiler has VLA (variable-length array) support,
otherwise define to 0])
AC_CACHE_CHECK(
[for variable template support],
[folly_cv_prog_cc_have_variable_templates],
[AC_COMPILE_IFELSE(
[AC_LANG_SOURCE[
template <class> constexpr bool g = true;
int main() {}
]],
[folly_cv_prog_cc_have_variable_templates=yes],
[folly_cv_prog_cc_have_variable_templates=no])])
AM_CONDITIONAL(
[HAVE_VARIABLE_TEMPLATES],
[test "x${folly_cv_prog_cc_have_variable_templates}" = "xyes"],
[Define to 1 if the compiler supports variable templates])
# Checks for library functions.
AC_CHECK_FUNCS([malloc_size \
malloc_usable_size \
......
......@@ -223,9 +223,11 @@ fingerprint_test_SOURCES = FingerprintTest.cpp
fingerprint_test_LDADD = libfollytestmain.la $(top_builddir)/libfollybenchmark.la
TESTS += fingerprint_test
if HAVE_VARIABLE_TEMPLATES
poly_test_SOURCES = PolyTest.cpp
poly_test_LDADD = libfollytestmain.la
TESTS += poly_test
endif
portability_test_SOURCES = PortabilityTest.cpp
portability_test_LDADD = libfollytestmain.la
......
......@@ -14,6 +14,9 @@
* limitations under the License.
*/
#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ < 5
#pragma message "Folly.Poly requires gcc-5 or greater"
#else
#include <folly/Poly.h>
#include <folly/Conv.h>
......@@ -560,3 +563,4 @@ TEST(Poly, Addable) {
cc = aref + bref;
EXPECT_EQ(6, poly_cast<int>(cc));
}
#endif
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