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

Update C++ standard to 14 and clean up #19490

Merged
merged 5 commits into from Dec 16, 2017

Conversation

Projects
None yet
5 participants
@adamemerson
Copy link
Contributor

commented Dec 13, 2017

Still an improvement!

#ifndef CEPH_COMMON_BACKPORT14_H
#define CEPH_COMMON_BACKPORT14_H

// Library code from C++14 that can be implemented in C++11.

This comment has been minimized.

Copy link
@cbodley

cbodley Dec 13, 2017

Contributor

nit: this comment can be updated

using remove_reference_t = typename std::remove_reference<T>::type;
template<typename T>
using result_of_t = typename std::result_of<T>::type;
// Template variable aliases from C++17 <type_traits>

This comment has been minimized.

Copy link
@tchaikov

tchaikov Dec 13, 2017

Contributor

can we guard this with #if __cplusplus < 201703L, and just put these templates into namespace std?

@adamemerson adamemerson force-pushed the adamemerson:wip-hypomodern branch from 4730bcc to 73d692d Dec 13, 2017

@adamemerson

This comment has been minimized.

Copy link
Contributor Author

commented Dec 13, 2017

@tchaikov Maaaaybe? It's Undefined Behavior and Bad and Naughty and so I'd rather not, but it would probably work.

I have a /better/ solution for this sort of problem I've been working on from time to time.

Generally, if we put everything in core inside the ceph namespace

And encapsulated things like this in a few inline namespaces so we could easily pull them into RGW and RBD and whatnot

Then we could easily change definitions to usings and things like that, but it's a fairly large project and I haven't had a chance to work on it recently.

@cbodley

This comment has been minimized.

Copy link
Contributor

commented Dec 13, 2017

It's Undefined Behavior and Bad and Naughty and so I'd rather not

that's my feeling as well. it might make our transitions between c++ versions a bit easier, but i don't think we do that often enough to get so adventurous

@adamemerson

This comment has been minimized.

Copy link
Contributor Author

commented Dec 13, 2017

Yeah, once we go to 17, whenever the CentOS people get their thing done, we won't have to change this sort of thing until …2020?

@tchaikov
Copy link
Contributor

left a comment

@adamemerson @cbodley makes sense to me!

build: Uplevel to C++14
Fix a couple problems.

Signed-off-by: Adam C. Emerson <aemerson@redhat.com>

@adamemerson adamemerson force-pushed the adamemerson:wip-hypomodern branch from 73d692d to dd927b8 Dec 14, 2017

@adamemerson

This comment has been minimized.

Copy link
Contributor Author

commented Dec 14, 2017

@tchaikov One minor error crept in during a rebase, just fixed it.

@adamemerson

This comment has been minimized.

Copy link
Contributor Author

commented Dec 14, 2017

Well, major in that it broke everything, but minor in terms of scope and fix and complexity.

template<typename T>
using remove_reference_t = typename std::remove_reference<T>::type;
template<typename T>
using result_of_t = typename std::result_of<T>::type;

This comment has been minimized.

Copy link
@tchaikov

tchaikov Dec 14, 2017

Contributor
In file included from /home/jenkins-build/build/workspace/ceph-pull-requests/src/common/dout.h:22:0,
                 from /home/jenkins-build/build/workspace/ceph-pull-requests/src/common/debug.h:18,
                 from /home/jenkins-build/build/workspace/ceph-pull-requests/src/compressor/Compressor.cc:22:
/home/jenkins-build/build/workspace/ceph-pull-requests/src/common/config.h:171:11: error: 'result_of_t' in namespace 'ceph' does not name a template type
     ceph::result_of_t<Callback(const T&, Args...)> {
           ^~~~~~~~~~~
/home/jenkins-build/build/workspace/ceph-pull-requests/src/common/config.h:171:22: error: expected initializer before '<' token
     ceph::result_of_t<Callback(const T&, Args...)> {
                      ^
src/compressor/CMakeFiles/compressor_objs.dir/build.make:62: recipe for target 'src/compressor/CMakeFiles/compressor_objs.dir/Compressor.cc.o' failed

@adamemerson

@@ -14,7 +14,7 @@
*
*/

#include "common/backport14.h" // include first: tests that header is standalone

This comment has been minimized.

common: Swap C++14 template type aliases for variables
C++14 provides the ability to define template variables, which the C++17
library puts to good use. We define those same aliases.

Signed-off-by: Adam C. Emerson <aemerson@redhat.com>

@adamemerson adamemerson force-pushed the adamemerson:wip-hypomodern branch from dd927b8 to c29d42b Dec 14, 2017

@adamemerson

This comment has been minimized.

Copy link
Contributor Author

commented Dec 14, 2017

Oops. My own merged patch did me in. Fixed and pushed. Will run a local compile to check anything else.

adamemerson added some commits Dec 6, 2017

common: Remove backported max and make_unique
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
common: Switch from boost::shared_mutex to std::shared_mutex
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
common: Get rid of artifact filename
Since we're on C++14, we're just backporting from future standards
generally.

Signed-off-by: Adam C. Emerson <aemerson@redhat.com>

@adamemerson adamemerson force-pushed the adamemerson:wip-hypomodern branch from c29d42b to e08a1cd Dec 14, 2017

@adamemerson

This comment has been minimized.

Copy link
Contributor Author

commented Dec 14, 2017

@tchaikov All right, got the problems I introduced by rebasing cleared away.

@tchaikov tchaikov merged commit 419a182 into ceph:master Dec 16, 2017

5 checks passed

Docs: build check OK - docs built
Details
Signed-off-by all commits in this PR are signed
Details
Unmodified Submodules submodules for project are unmodified
Details
make check make check succeeded
Details
make check (arm64) make check succeeded
Details
@cbodley

This comment has been minimized.

Copy link
Contributor

commented Dec 18, 2017

exciting! 🎉 you are my heroes, @tchaikov and @adamemerson!

@chardan

This comment has been minimized.

Copy link
Contributor

commented Dec 18, 2017

Very cool!!

@adamemerson adamemerson deleted the adamemerson:wip-hypomodern branch Dec 20, 2017

@theanalyst

This comment has been minimized.

Copy link
Member

commented Dec 28, 2017

Awesome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.