You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by jo...@apache.org on 2015/10/18 02:11:37 UTC

[02/12] mesos git commit: Windows: Move ::UUID to id::UUID to avoid namespace collision.

Windows: Move ::UUID to id::UUID to avoid namespace collision.

The `Windows.h` head includes a header that defines the UUID struct for
the DCE RPC API. This is dumped into the global namespace, just like our
UUID implementation found in `stout/uuid.hpp`.

Since this causes a compilation error on Windows, we simply move our
UUID into `id::`. We further add a `using id::UUID;` in the file so that
we don't have to change every callsite in the Mesos codebase that uses
it.

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


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

Branch: refs/heads/master
Commit: c8eca6c0a188c8b6087d9e08af8ff62af7b043d7
Parents: e7201e3
Author: Alex Clemmer <cl...@gmail.com>
Authored: Sat Oct 17 18:05:14 2015 -0400
Committer: Joris Van Remoortere <jo...@gmail.com>
Committed: Sat Oct 17 20:11:13 2015 -0400

----------------------------------------------------------------------
 .../libprocess/3rdparty/stout/include/stout/uuid.hpp    | 12 ++++++++++++
 1 file changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/c8eca6c0/3rdparty/libprocess/3rdparty/stout/include/stout/uuid.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/uuid.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/uuid.hpp
index bc167f1..737d13f 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/uuid.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/uuid.hpp
@@ -25,6 +25,13 @@
 
 #include <stout/thread_local.hpp>
 
+// NOTE: This namespace is necessary because the standard Windows headers
+// define a UUID struct in the global namespace for the DCE RPC API. We put
+// this in the `id::` namespace to avoid collisions. Note also that we include
+// a line below, `using id::UUID`, which allows us to avoid being forced to
+// change most of the callsites that use `UUID` to use `id::UUID` instead.
+namespace id {
+
 struct UUID : boost::uuids::uuid
 {
 public:
@@ -72,6 +79,11 @@ private:
     : boost::uuids::uuid(uuid) {}
 };
 
+} // namespace id {
+
+// NOTE: see comment for the line `namespace id {`, near the top of the file.
+using id::UUID;
+
 namespace std {
 
 template <>