You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2014/01/17 02:37:53 UTC

[1/2] git commit: Used UNREACHABLE to silence a compiler warning.

Updated Branches:
  refs/heads/master 420e30bfe -> 5c478106e


Used UNREACHABLE to silence a compiler warning.

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


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

Branch: refs/heads/master
Commit: 5c478106edea5b1986cedb44ef563cddd8766e44
Parents: 2a04b92
Author: Benjamin Hindman <be...@gmail.com>
Authored: Wed Jan 15 17:22:41 2014 -0800
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Thu Jan 16 17:32:34 2014 -0800

----------------------------------------------------------------------
 3rdparty/libprocess/src/process.cpp | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/5c478106/3rdparty/libprocess/src/process.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/process.cpp b/3rdparty/libprocess/src/process.cpp
index 67f7f9b..8cad696 100644
--- a/3rdparty/libprocess/src/process.cpp
+++ b/3rdparty/libprocess/src/process.cpp
@@ -70,6 +70,7 @@
 #include <stout/os.hpp>
 #include <stout/strings.hpp>
 #include <stout/thread.hpp>
+#include <stout/unreachable.hpp>
 
 #include "config.hpp"
 #include "decoder.hpp"
@@ -1845,6 +1846,8 @@ Socket SocketManager::accepted(int s)
   synchronized (this) {
     return sockets[s] = Socket(s);
   }
+
+  return UNREACHABLE(); // Quiet the compiler.
 }
 
 


[2/2] git commit: Added UNREACHABLE to stout.

Posted by be...@apache.org.
Added UNREACHABLE to stout.

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


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

Branch: refs/heads/master
Commit: 2a04b9226eb858371bb8273918db6c2dac06dcd6
Parents: 420e30b
Author: Benjamin Hindman <be...@gmail.com>
Authored: Wed Jan 15 17:22:30 2014 -0800
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Thu Jan 16 17:32:34 2014 -0800

----------------------------------------------------------------------
 3rdparty/libprocess/3rdparty/stout/Makefile.am  |  1 +
 .../stout/include/stout/unreachable.hpp         | 44 ++++++++++++++++++++
 2 files changed, 45 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/2a04b922/3rdparty/libprocess/3rdparty/stout/Makefile.am
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/Makefile.am b/3rdparty/libprocess/3rdparty/stout/Makefile.am
index 0725722..d83ad25 100644
--- a/3rdparty/libprocess/3rdparty/stout/Makefile.am
+++ b/3rdparty/libprocess/3rdparty/stout/Makefile.am
@@ -61,6 +61,7 @@ EXTRA_DIST =					\
   include/stout/strings.hpp			\
   include/stout/thread.hpp			\
   include/stout/try.hpp				\
+  include/stout/unreachable.hpp			\
   include/stout/utils.hpp			\
   include/stout/uuid.hpp			\
   tests/bytes_tests.cpp				\

http://git-wip-us.apache.org/repos/asf/mesos/blob/2a04b922/3rdparty/libprocess/3rdparty/stout/include/stout/unreachable.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/unreachable.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/unreachable.hpp
new file mode 100644
index 0000000..3568886
--- /dev/null
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/unreachable.hpp
@@ -0,0 +1,44 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __STOUT_UNREACHABLE_HPP__
+#define __STOUT_UNREACHABLE_HPP__
+
+#include <iostream>
+
+#define UNREACHABLE() Unreachable(__FILE__, __LINE__)
+
+struct Unreachable
+{
+  Unreachable(const std::string& _file, int _line)
+    : file(_file), line(_line) {}
+
+  template <typename T>
+  operator T () const
+  {
+    // TODO(benh): Print stack trace too.
+    std::cerr << "Reached unreachable statement at "
+              << file << ":" << line << std::endl;
+    abort();
+
+    // Note that dereference a T* since T might not be default
+    // constructable and can't just 'return T()'.
+    return *((T*) NULL);
+  }
+
+private:
+  const std::string file;
+  const int line;
+};
+
+#endif // __STOUT_UNREACHABLE_HPP__