You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ti...@apache.org on 2017/02/16 19:27:32 UTC

[2/3] mesos git commit: Rejected optimizing if we are working with a libcxx with UB.

Rejected optimizing if we are working with a libcxx with UB.

Review: https://reviews.apache.org/r/55772/


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

Branch: refs/heads/master
Commit: f91bece951076ac207baa6fa51c07698de7cc1fe
Parents: b26b432
Author: Benjamin Bannier <be...@mesosphere.io>
Authored: Thu Feb 16 18:06:11 2017 +0100
Committer: Till Toenshoff <to...@me.com>
Committed: Thu Feb 16 18:06:11 2017 +0100

----------------------------------------------------------------------
 3rdparty/libprocess/configure.ac | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/f91bece9/3rdparty/libprocess/configure.ac
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/configure.ac b/3rdparty/libprocess/configure.ac
index 48e3b14..1540006 100644
--- a/3rdparty/libprocess/configure.ac
+++ b/3rdparty/libprocess/configure.ac
@@ -1018,6 +1018,37 @@ you can get away without it by doing --disable-zlib.
 fi
 
 
+# Once all CXXFLAGS are completely assembled, make sure the we are not
+# affected by libcxx undefined behavior,
+# https://llvm.org/bugs/show_bug.cgi?id=28469.
+AC_MSG_CHECKING([C++ standard library for undefined behaviour with selected optimization level])
+AC_LANG_PUSH([C++])
+AC_RUN_IFELSE([
+  AC_LANG_SOURCE([[
+    #include <functional>
+    #include <map>
+
+    struct F {
+      std::map<int, std::function<void()>> m;
+      F() { m[42] = []() {}; }
+    };
+
+    int main() {
+      F f;
+      f = F{};
+    }
+  ]])],
+  [
+    AC_MSG_RESULT([no])
+  ], [
+    AC_MSG_RESULT([yes])
+    AC_MSG_ERROR([libprocess cannot be built with optimizations against this version of libcxx (MESOS-5745).
+                  Consider building without optimizations, or changing the used C++ standard library.])
+  ]
+)
+AC_LANG_POP([C++])
+
+
 # Also pass the flags to 3rdparty libraries.
 CONFIGURE_ARGS="$CONFIGURE_ARGS CXXFLAGS='$CXXFLAGS'"