James Peach created MESOS-8763:
----------------------------------

             Summary: Enable -Wshadow in the build.
                 Key: MESOS-8763
                 URL: https://issues.apache.org/jira/browse/MESOS-8763
             Project: Mesos
          Issue Type: Improvement
          Components: build
            Reporter: James Peach


Shadowed variables are a source of confusion and bugs. We should enable 
{{-Wshadow}} and eliminated these permanently. We would need to solve the 
shadowing issues that we get from our 3rd party dependencies.

{noformat}
In file included from ../../src/common/protobuf_utils.cpp:28:
In file included from ../../include/mesos/slave/isolator.hpp:27:
In file included from ../../3rdparty/libprocess/include/process/dispatch.hpp:20:
../../3rdparty/libprocess/include/process/process.hpp:242:54: error: 
declaration shadows a field of 'process::ProcessBase' [-Werror,-Wshadow]
  void delegate(const std::string& name, const UPID& pid)
                                                     ^
../../3rdparty/libprocess/include/process/process.hpp:488:8: note: previous 
declaration is here
  UPID pid;
       ^
In file included from ../../src/common/protobuf_utils.cpp:53:
In file included from ../../src/master/master.hpp:51:
../../3rdparty/libprocess/include/process/protobuf.hpp:460:12: error: 
declaration shadows a local variable [-Werror,-Wshadow]
    { Req* req = nullptr; google::protobuf::Message* m = req; (void)m; }
           ^
../../3rdparty/libprocess/include/process/protobuf.hpp:457:18: note: previous 
declaration is here
      const Req& req) const
                 ^
In file included from ../../src/common/protobuf_utils.cpp:53:
In file included from ../../src/master/master.hpp:54:
In file included from 
../../3rdparty/libprocess/include/process/metrics/counter.hpp:19:
In file included from 
../../3rdparty/libprocess/include/process/metrics/metric.hpp:22:
In file included from 
../../3rdparty/libprocess/include/process/statistics.hpp:21:
../../3rdparty/libprocess/include/process/timeseries.hpp:106:24: error: 
declaration shadows a field of 'TimeSeries<T>' [-Werror,-Wshadow]
    std::vector<Value> values;
                       ^
../../3rdparty/libprocess/include/process/timeseries.hpp:242:21: note: previous 
declaration is here
  std::map<Time, T> values;
                    ^
In file included from ../../src/common/protobuf_utils.cpp:53:
In file included from ../../src/master/master.hpp:79:
In file included from ../../src/master/flags.hpp:36:
In file included from ../../src/messages/flags.hpp:30:
../../src/common/parse.hpp:119:35: error: declaration shadows a local variable 
[-Werror,-Wshadow]
               const JSON::Value& value,
                                  ^
../../src/common/parse.hpp:108:72: note: previous declaration is here
inline Try<hashmap<std::string, std::string>> parse(const std::string& value)
                                                                       ^
In file included from ../../src/common/protobuf_utils.cpp:53:
../../src/master/master.hpp:2983:46: error: declaration shadows a field of 
'mesos::internal::master::Role' [-Werror,-Wshadow]
    auto allocatedTo = [](const std::string& role) {
                                             ^
../../src/master/master.hpp:2998:21: note: previous declaration is here
  const std::string role;
                    ^
{noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to