Skip to content

update filter name() method#109

Merged
htuch merged 2 commits intoenvoyproxy:masterfrom
kyessenov:fix_signature
Dec 31, 2019
Merged

update filter name() method#109
htuch merged 2 commits intoenvoyproxy:masterfrom
kyessenov:fix_signature

Conversation

@kyessenov
Copy link
Copy Markdown
Contributor

Signed-off-by: Kuat Yessenov kuat@google.com

Signed-off-by: Kuat Yessenov <kuat@google.com>
echo2_config.cc Outdated
}

std::string name() override { return "echo2"; }
const std::string name() const override { return "echo2"; }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this const std::string()? It should either be std::string or const std::string& I think.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't want the filter to own its name string. Fine dropping const from std::string if you think that's better.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, const std::string for a return value doesn't do anything so it should be dropped IMHO.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Signed-off-by: Kuat Yessenov <kuat@google.com>
Copy link
Copy Markdown
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ta

@htuch htuch merged commit 5a05fb0 into envoyproxy:master Dec 31, 2019
@dio
Copy link
Copy Markdown
Member

dio commented Dec 31, 2019

@kyessenov, sorry, does that name() should override https://github.com/envoyproxy/envoy/blob/11934bd081011cd7d58a9d49be4965917cce8aa0/include/envoy/server/filter_config.h#L349? Seems like it's failing?

https://circleci.com/gh/envoyproxy/envoy-filter-example/6958

echo2_config.cc:28:28: error: non-virtual member function marked 'override' hides virtual member function
  std::string name() const override { return "echo2"; }
                           ^
bazel-out/k8-fastbuild/bin/external/envoy/include/envoy/server/_virtual_includes/filter_config_interface/envoy/server/filter_config.h:349:23: note: hidden overloaded virtual function 'Envoy::Server::Configuration::NamedNetworkFilterConfigFactory::name' declared here: different qualifiers (unqualified vs 'const')
  virtual std::string name() PURE;
                      ^
In file included from echo2_config.cc:5:
bazel-out/k8-fastbuild/bin/external/envoy/include/envoy/registry/_virtual_includes/registry/envoy/registry/registry.h:322:5: error: field type 'Envoy::Server::Configuration::Echo2ConfigFactory' is an abstract class
  T instance_{};
    ^
echo2_config.cc:36:87: note: in instantiation of template class 'Envoy::Registry::RegisterFactory<Envoy::Server::Configuration::Echo2ConfigFactory, Envoy::Server::Configuration::NamedNetworkFilterConfigFactory>' requested here
static Registry::RegisterFactory<Echo2ConfigFactory, NamedNetworkFilterConfigFactory> registered_;
                                                                                      ^
bazel-out/k8-fastbuild/bin/external/envoy/include/envoy/server/_virtual_includes/filter_config_interface/envoy/server/filter_config.h:349:23: note: unimplemented pure virtual method 'name' in 'Echo2ConfigFactory'
  virtual std::string name() PURE;
                      ^

@kyessenov
Copy link
Copy Markdown
Contributor Author

kyessenov commented Jan 2, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants