You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by ro...@apache.org on 2015/04/26 16:06:04 UTC

thrift git commit: THRIFT-3113 m4 C++11 macro issue

Repository: thrift
Updated Branches:
  refs/heads/master 1684c4295 -> e856d6846


THRIFT-3113 m4 C++11 macro issue

Make it cross-compile happy the hard way, there's no clean way.
Make zlib version detection cross-compile happy.

Signed-off-by: Gustavo Zacarias <gu...@zacarias.com.ar>
Signed-off-by: Romain Naour <ro...@openwide.fr>

autotools: update ax_cxx_compile_stdcxx_11.m4 to version 10

The ax_cxx_compile_stdcxx_11 macro bundled in thrift package is
brocken [1] and out of date.

Since Thrift actually doesn't use that particular C++11 feature,
make C++11 support optional.

[1] https://savannah.gnu.org/patch/index.php?8287

Fixes:
[thrift]
http://autobuild.buildroot.net/results/21e/21e3fff1e0d714f94ac7e621289d1a59bc02a05f/build-end.log
[host-thrift]
http://autobuild.buildroot.net/results/b89/b89ffc2bff699eb10bb6abd92369a43d4900354d/build-end.log

Signed-off-by: Romain Naour <ro...@openwide.fr>

This closes: #462


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/e856d684
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/e856d684
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/e856d684

Branch: refs/heads/master
Commit: e856d6846bce5402cc79f7bbaa59897690080017
Parents: 1684c42
Author: Gustavo Zacarias <gu...@zacarias.com.ar>
Authored: Sat Apr 25 17:53:28 2015 +0200
Committer: Roger Meier <ro...@apache.org>
Committed: Sun Apr 26 16:03:38 2015 +0200

----------------------------------------------------------------------
 aclocal/ax_cxx_compile_stdcxx_11.m4 | 45 +++++++++++++++++++++++++++-----
 aclocal/ax_lib_event.m4             |  2 +-
 aclocal/ax_lib_zlib.m4              |  2 +-
 configure.ac                        |  2 +-
 4 files changed, 41 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/e856d684/aclocal/ax_cxx_compile_stdcxx_11.m4
----------------------------------------------------------------------
diff --git a/aclocal/ax_cxx_compile_stdcxx_11.m4 b/aclocal/ax_cxx_compile_stdcxx_11.m4
index a4c9189..a9a8f58 100644
--- a/aclocal/ax_cxx_compile_stdcxx_11.m4
+++ b/aclocal/ax_cxx_compile_stdcxx_11.m4
@@ -27,21 +27,29 @@
 #   Copyright (c) 2008 Benjamin Kosnik <bk...@redhat.com>
 #   Copyright (c) 2012 Zack Weinberg <za...@panix.com>
 #   Copyright (c) 2013 Roy Stogner <ro...@ices.utexas.edu>
+#   Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov <so...@google.com>
 #
 #   Copying and distribution of this file, with or without modification, are
 #   permitted in any medium without royalty provided the copyright notice
 #   and this notice are preserved. This file is offered as-is, without any
 #   warranty.
 
-#serial 3
+#serial 10
 
-m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [
+m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [[
   template <typename T>
     struct check
     {
       static_assert(sizeof(int) <= sizeof(T), "not big enough");
     };
 
+    struct Base {
+    virtual void f() {}
+    };
+    struct Child : public Base {
+    virtual void f() override {}
+    };
+
     typedef check<check<bool>> right_angle_brackets;
 
     int a;
@@ -52,7 +60,31 @@ m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [
     check_type&& cr = static_cast<check_type&&>(c);
 
     auto d = a;
-])
+    auto l = [](){};
+    // Prevent Clang error: unused variable 'l' [-Werror,-Wunused-variable]
+    struct use_l { use_l() { l(); } };
+
+    // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae
+    // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function because of this
+    namespace test_template_alias_sfinae {
+        struct foo {};
+
+        template<typename T>
+        using member = typename T::member_type;
+
+        template<typename T>
+        void func(...) {}
+
+        template<typename T>
+        void func(member<T>*) {}
+
+        void test();
+
+        void test() {
+            func<foo>(0);
+        }
+    }
+]])
 
 AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl
   m4_if([$1], [], [],
@@ -62,7 +94,7 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl
   m4_if([$2], [], [ax_cxx_compile_cxx11_required=true],
         [$2], [mandatory], [ax_cxx_compile_cxx11_required=true],
         [$2], [optional], [ax_cxx_compile_cxx11_required=false],
-        [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX_11])])dnl
+        [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX_11])])
   AC_LANG_PUSH([C++])dnl
   ac_success=no
   AC_CACHE_CHECK(whether $CXX supports C++11 features by default,
@@ -76,7 +108,7 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl
 
   m4_if([$1], [noext], [], [dnl
   if test x$ac_success = xno; then
-    for switch in -std=gnu++11; do
+    for switch in -std=gnu++11 -std=gnu++0x; do
       cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
       AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
                      $cachevar,
@@ -96,7 +128,7 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl
 
   m4_if([$1], [ext], [], [dnl
   if test x$ac_success = xno; then
-    for switch in -std=c++11; do
+    for switch in -std=c++11 -std=c++0x; do
       cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
       AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
                      $cachevar,
@@ -131,4 +163,3 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl
     AC_SUBST(HAVE_CXX11)
   fi
 ])
-

http://git-wip-us.apache.org/repos/asf/thrift/blob/e856d684/aclocal/ax_lib_event.m4
----------------------------------------------------------------------
diff --git a/aclocal/ax_lib_event.m4 b/aclocal/ax_lib_event.m4
index cf6c4c2..d4dcdc9 100644
--- a/aclocal/ax_lib_event.m4
+++ b/aclocal/ax_lib_event.m4
@@ -75,7 +75,7 @@ AC_DEFUN([AX_LIB_EVENT_DO_CHECK],
           AC_LANG_PUSH([C])
           dnl This can be changed to AC_LINK_IFELSE if you are cross-compiling,
           dnl but then the version cannot be checked.
-          AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+          AC_LINK_IFELSE([AC_LANG_PROGRAM([[
           #include <sys/types.h>
           #include <event.h>
           ]], [[

http://git-wip-us.apache.org/repos/asf/thrift/blob/e856d684/aclocal/ax_lib_zlib.m4
----------------------------------------------------------------------
diff --git a/aclocal/ax_lib_zlib.m4 b/aclocal/ax_lib_zlib.m4
index 8c10ab4..bdb9e11 100644
--- a/aclocal/ax_lib_zlib.m4
+++ b/aclocal/ax_lib_zlib.m4
@@ -73,7 +73,7 @@ AC_DEFUN([AX_LIB_ZLIB_DO_CHECK],
           #   (defined in the library).
           AC_LANG_PUSH([C])
           dnl This can be changed to AC_LINK_IFELSE if you are cross-compiling.
-          AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+          AC_LINK_IFELSE([AC_LANG_PROGRAM([[
           #include <zlib.h>
           #if ZLIB_VERNUM >= 0x$WANT_ZLIB_VERSION
           #else

http://git-wip-us.apache.org/repos/asf/thrift/blob/e856d684/configure.ac
----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index b1a79e7..791eead 100755
--- a/configure.ac
+++ b/configure.ac
@@ -99,7 +99,7 @@ AC_PROG_AWK
 AC_PROG_RANLIB
 
 AC_LANG([C++])
-AX_CXX_COMPILE_STDCXX_11([noext])
+AX_CXX_COMPILE_STDCXX_11([noext], [optional])
 
 AM_EXTRA_RECURSIVE_TARGETS([style])
 AC_SUBST(CPPSTYLE_CMD, 'find . -type f \( -iname "*.h" -or -iname "*.cpp" -or -iname "*.cc" -or -iname "*.tcc" \) -printf "Reformatting: %h/%f\n" -exec clang-format -i {} \;')