Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid unused warning #2342

Merged
merged 2 commits into from
Mar 27, 2024
Merged

Avoid unused warning #2342

merged 2 commits into from
Mar 27, 2024

Conversation

heifner
Copy link
Member

@heifner heifner commented Mar 27, 2024

Workaround unused compiler warning. Note [[maybe_unused]] does not work for lambda captures.

@heifner heifner requested review from spoonincode and greg7mdp March 27, 2024 17:14
@spoonincode
Copy link
Member

http is only used for a single INVOKE so I think it might be cleaner to

--- a/plugins/producer_api_plugin/producer_api_plugin.cpp
+++ b/plugins/producer_api_plugin/producer_api_plugin.cpp
@@ -23,7 +23,7 @@ using namespace eosio;
 #define CALL_WITH_400(api_name, category, api_handle, call_name, INVOKE, http_response_code) \
 {std::string("/v1/" #api_name "/" #call_name), \
    api_category::category, \
-   [&http, &producer](string&&, string&& body, url_response_callback&& cb) mutable { \
+   [&producer](string&&, string&& body, url_response_callback&& cb) mutable { \
           try { \
              INVOKE \
              cb(http_response_code, fc::variant(result)); \
@@ -63,7 +63,7 @@ using namespace eosio;
      auto result = api_handle.call_name(std::move(params));

 #define INVOKE_R_R_D(api_handle, call_name, in_param) \
-     const fc::microseconds http_max_response_time = http.get_max_response_time(); \
+     const fc::microseconds http_max_response_time = app().get_plugin<http_plugin>().get_max_response_time(); \
      auto deadline = http_max_response_time == fc::microseconds::maximum() ? fc::time_point::maximum() \
                                                                            : fc::time_point::now() + http_max_response_time; \
      auto params = parse_params<in_param, http_params_types::possible_no_params>(body);\
@@ -91,7 +91,6 @@ void producer_api_plugin::plugin_startup() {
    ilog("starting producer_api_plugin");
    // lifetime of plugin is lifetime of application
    auto& producer = app().get_plugin<producer_plugin>();
-   auto& http = app().get_plugin<http_plugin>();

    app().get_plugin<http_plugin>().add_api({
        CALL_WITH_400(producer, producer_ro, producer, paused,

@ericpassmore
Copy link
Contributor

Note:start
group: CLEANCODE
category: INTERNALS
summary: Workaround to avoid unused compiler warning.
Note: end

@heifner heifner added the OCI Work exclusive to OCI team label Mar 27, 2024
@heifner heifner merged commit cf67b13 into main Mar 27, 2024
34 checks passed
@heifner heifner deleted the fix-warning branch March 27, 2024 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCI Work exclusive to OCI team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants