You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ch...@apache.org on 2018/08/31 20:02:36 UTC

[mesos] 06/08: Fixed SLRP compilation with Clang 3.5.

This is an automated email from the ASF dual-hosted git repository.

chhsiao pushed a commit to branch 1.7.x
in repository https://gitbox.apache.org/repos/asf/mesos.git

commit 9514806aa4f9f90582f664c38242bf9d44a23450
Author: Chun-Hung Hsiao <ch...@mesosphere.io>
AuthorDate: Wed Aug 29 18:19:48 2018 -0700

    Fixed SLRP compilation with Clang 3.5.
    
    Clang 3.5 incorrectly keeps const qualifiers when inferring the return
    types of lambdas if their return expressions are const-qualified. This
    patch makes the return types explicit to avoid this issue when compiling
    SLRP and its tests.
    
    Review: https://reviews.apache.org/r/68565
---
 src/resource_provider/storage/provider.cpp | 8 +++++---
 src/tests/disk_profile_server.hpp          | 4 +++-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/resource_provider/storage/provider.cpp b/src/resource_provider/storage/provider.cpp
index fc48072..ab1467c 100644
--- a/src/resource_provider/storage/provider.cpp
+++ b/src/resource_provider/storage/provider.cpp
@@ -1886,7 +1886,8 @@ Future<csi::v0::Client> StorageLocalResourceProviderProcess::connect(
   return future
     .then(defer(self(), [=](csi::v0::Client client) {
       return call<csi::v0::PROBE>(client, csi::v0::ProbeRequest())
-        .then(defer(self(), [=](const csi::v0::ProbeResponse& response) {
+        .then(defer(self(), [=](
+            const csi::v0::ProbeResponse& response) -> csi::v0::Client {
           return client;
         }));
     }));
@@ -1980,7 +1981,7 @@ Future<csi::v0::Client> StorageLocalResourceProviderProcess::getService(
       commandInfo,
       config->resources(),
       containerInfo,
-      std::function<Future<Nothing>()>(defer(self(), [=]() {
+      std::function<Future<Nothing>()>(defer(self(), [=]() -> Future<Nothing> {
         CHECK(services.at(containerId)->future().isPending());
 
         return connect(endpointPath)
@@ -2620,7 +2621,8 @@ Future<string> StorageLocalResourceProviderProcess::createVolume(
       *request.mutable_parameters() = profileInfo.parameters;
 
       return call<csi::v0::CREATE_VOLUME>(client, std::move(request))
-        .then(defer(self(), [=](const csi::v0::CreateVolumeResponse& response) {
+        .then(defer(self(), [=](
+            const csi::v0::CreateVolumeResponse& response) -> string {
           const csi::v0::Volume& volume = response.volume();
 
           if (volumes.contains(volume.id())) {
diff --git a/src/tests/disk_profile_server.hpp b/src/tests/disk_profile_server.hpp
index 1a8d291..ee8e54a 100644
--- a/src/tests/disk_profile_server.hpp
+++ b/src/tests/disk_profile_server.hpp
@@ -73,7 +73,9 @@ public:
     std::shared_ptr<TestDiskProfileServer>  server(new TestDiskProfileServer());
 
     // Wait for the process to finish initializing so that the routes are ready.
-    return process::dispatch(server->process->self(), [=] { return server; });
+    return process::dispatch(
+        server->process->self(),
+        [=]() -> std::shared_ptr<TestDiskProfileServer> { return server; });
   }
 
   ~TestDiskProfileServer()