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

Fix compile error on platform010 #11344

Closed
wants to merge 1 commit into from

Conversation

guowentian
Copy link
Contributor

We have recently switched to using platform010 #11333. Now the main branch has compilation error mainly because std::reference_wrapper is not compatible when we are expecting the type T.

Examples of errors:

cache/cache_bench_tool.cc:618:12: error: format ‘%u’ expects argument of type ‘unsigned int’, but argument 2 has type ‘std::reference_wrapper<unsigned int>’ [-Werror=format=]
     printf("Number of threads   : %u\n", FLAGS_threads);
cache/cache_bench_tool.cc:722:28: error: use of deleted function ‘std::reference_wrapper<_Tp>::reference_wrapper(_Tp&&) [with _Tp = unsigned int]’
       FLAGS_sck_db_count = 1;
cache/cache_bench_tool.cc:773:16: error: format ‘%u’ expects argument of type ‘unsigned int’, but argument 4 has type ‘std::reference_wrapper<unsigned int>’ [-Werror=format=]
         printf("%" PRIu64
                ^~~~~~~~~~
                " collisions after %d x %u days, est %g days between (%g "
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                "corrected)        \n",
                ~~~~~~~~~~~~~~~~~~~~~~
                collisions_, i, FLAGS_sck_days_per_run, est, est * multiplier_);

Hereby, fix the error by using .get() method

@guowentian guowentian requested review from pdillinger and hx235 April 2, 2023 21:37
@guowentian guowentian marked this pull request as draft April 2, 2023 21:39
@guowentian
Copy link
Contributor Author

The compilation can pass locally, but fail in circleci. Not sure why. It seems clang++ can't recognize .get() member function

pdillinger added a commit to pdillinger/rocksdb that referenced this pull request Apr 3, 2023
Summary: Was getting compilation failure with old verison of gflags,
examples in facebook#11344.  Perhaps this is new since enabling C++17.
Getting rid of std::reference_wrapper from facebook#10729 seems to fix it.

Test Plan: manual, CI
@pdillinger pdillinger mentioned this pull request Apr 3, 2023
facebook-github-bot pushed a commit that referenced this pull request Apr 3, 2023
Summary:
Was getting compilation failure with old verison of gflags, examples in #11344.  Perhaps this is new since enabling C++17. Getting rid of std::reference_wrapper from #10729 seems to fix it.

Pull Request resolved: #11346

Test Plan: manual, CI

Reviewed By: guowentian

Differential Revision: D44632776

Pulled By: pdillinger

fbshipit-source-id: 5c1f3f79a055698574538b6342c912a627b6d061
@guowentian guowentian closed this Apr 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants