don't try to run the poly tests on gcc-4.9. they will fail.
authorEric Niebler <eniebler@fb.com>
Thu, 2 Nov 2017 23:58:07 +0000 (16:58 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Fri, 3 Nov 2017 00:16:39 +0000 (17:16 -0700)
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

folly/Makefile.am
folly/Poly.cpp
folly/Poly.h
folly/configure.ac
folly/test/Makefile.am
folly/test/PolyTest.cpp

index c24cd2c0831a46b78f6d1895a5e166ed5ea411e1..79bcecb02ad150aaf36d7267843e07389e991a97 100644 (file)
@@ -571,7 +571,6 @@ libfolly_la_SOURCES = \
        detail/SocketFastOpen.cpp \
        MacAddress.cpp \
        memory/ThreadCachedArena.cpp \
        detail/SocketFastOpen.cpp \
        MacAddress.cpp \
        memory/ThreadCachedArena.cpp \
-       Poly.cpp \
        portability/Dirent.cpp \
        portability/Fcntl.cpp \
        portability/Libgen.cpp \
        portability/Dirent.cpp \
        portability/Fcntl.cpp \
        portability/Libgen.cpp \
@@ -713,6 +712,11 @@ libfolly_la_SOURCES += \
        experimental/symbolizer/Symbolizer.cpp
 endif
 
        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
 
 libfollybasesse42_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(LT_VERSION)
 libfollybasesse42_la_CXXFLAGS = -msse4.2 -mpclmul
 
index 352b1a0fedfd7a6c79f4744c287b341f8bf7be1c..93829baf3c92c0a7ab0447b90fddf5574b88208e 100644 (file)
  * limitations under the License.
  */
 
  * 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 {
 #include <folly/Poly.h>
 
 namespace folly {
@@ -22,3 +26,5 @@ namespace detail {
 [[noreturn]] void throwBadPolyCast() { throw BadPolyCast(); }
 } // namespace detail
 } // namespace folly
 [[noreturn]] void throwBadPolyCast() { throw BadPolyCast(); }
 } // namespace detail
 } // namespace folly
+
+#endif
index 218fbd8950e9924ce3f6a1e926c43c9cf993f865..6acac6826461223af938f2432d38bddc368122e9 100644 (file)
 
 #pragma once
 
 
 #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>
 #include <cassert>
 #include <new>
 #include <type_traits>
index 181f46872edf1a785d52357769d1a68f96f7b7ca..826972e2c123d689bc684c14afcd79ea0e6dd731 100644 (file)
@@ -525,6 +525,22 @@ AC_DEFINE_UNQUOTED(
   [Define to 1 if the compiler has VLA (variable-length array) support,
    otherwise define to 0])
 
   [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 \
 # Checks for library functions.
 AC_CHECK_FUNCS([malloc_size \
                 malloc_usable_size \
index dc49c5f896455554584dd1b68e333419f3f4ec2e..e5da501036cc64887e3a0c35b3e6f0b1d67ed881 100644 (file)
@@ -223,9 +223,11 @@ fingerprint_test_SOURCES = FingerprintTest.cpp
 fingerprint_test_LDADD = libfollytestmain.la $(top_builddir)/libfollybenchmark.la
 TESTS += fingerprint_test
 
 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
 poly_test_SOURCES = PolyTest.cpp
 poly_test_LDADD = libfollytestmain.la
 TESTS += poly_test
+endif
 
 portability_test_SOURCES = PortabilityTest.cpp
 portability_test_LDADD = libfollytestmain.la
 
 portability_test_SOURCES = PortabilityTest.cpp
 portability_test_LDADD = libfollytestmain.la
index bbd13b8f2a8cb91fcef7a9ad3b53d4428d1a8d3a..7083a464281b9d958f8923bc42e2cec7e3936156 100644 (file)
@@ -14,6 +14,9 @@
  * limitations under the License.
  */
 
  * 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>
 #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));
 }
   cc = aref + bref;
   EXPECT_EQ(6, poly_cast<int>(cc));
 }
+#endif