Switch to c++14
ClosedPublic

Authored by wojnilowicz on Jun 25 2017, 5:22 PM.

Details

Reviewers
tbaumgart
Group Reviewers
KMyMoney
Commits
R261:4cacaab3005a: Switch to c++14
Summary

According to cppreference GCC, Clang, and MSVC support c++14, so nothing stops us from switching.

Diff Detail

Repository
R261 KMyMoney
Lint
Lint Skipped
Unit
Unit Tests Skipped
wojnilowicz created this revision.Jun 25 2017, 5:22 PM
tbaumgart requested changes to this revision.Jun 25 2017, 7:23 PM
tbaumgart added a subscriber: tbaumgart.

c++: error: unrecognized command line option ‘-std=c++14’

This happens on my stock distro. So we should better stick with c++11 for some more time.

This revision now requires changes to proceed.Jun 25 2017, 7:23 PM
wojnilowicz abandoned this revision.Jun 26 2017, 2:41 PM

c++: error: unrecognized command line option ‘-std=c++14’

This happens on my stock distro. So we should better stick with c++11 for some more time.

I guess it's deeper matter and installing this wouldn't suffice. It seems we need to get by without c++14.

Even if that would suffice, it would only be for OpenSuse. Every distro goes at their own pace for such upgrades, and LTS versions often are quite behind the leading edge.

I am with Łukasz. If all developers can compile KMyMoney I am all in. I would not worry about the distros because until we can release this version this won't be an issue anymore.

CMakeLists.txt
65

Removing the MSVC check will cause annoying compiler warnings.

66

This comment is still valid.

wojnilowicz marked 2 inline comments as done.Jun 26 2017, 7:46 PM

I am with Łukasz. If all developers can compile KMyMoney I am all in. I would not worry about the distros because until we can release this version this won't be an issue anymore.

I'm avid front runner, but I'm not 100% sure about the switch.
I mean Qt only lately switched to c++11 in Qt 5.7. KDE Frameworks still uses c++11. On the other hand, oldest supported GCC version is 5.4 and it's capable of c++14.
I wonder what will distros do. Wouldn't they ship KMM if we would have c++14 or would they compile it anyways with special compiler that supports c++14. On the other hand, if they provide so old software, would they be interested at all in our fresh KMM. If no, then I'm all in for switching to c++14.

CMakeLists.txt
65

Will MSVC compile c++14 code correctly with that check left untouched?

66

Have you seen this? According to that website GCC's an MSVC's capabilities for c++14 are equal, so how this comment be still valid?

wojnilowicz marked 2 inline comments as done.Jun 26 2017, 7:46 PM

I am with Łukasz. If all developers can compile KMyMoney I am all in. I would not worry about the distros because until we can release this version this won't be an issue anymore.

I would be too, but on my stock openSUSE Leap 42.2 which I installed just a few weeks ago from scratch, I have

thb@thb-nb:~/bin$ g++ --version
g++ (SUSE Linux) 4.8.5
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

and using the proposed change does not work. Not sure if there is a newer version available and how I would install and not brake anything.

I am with Łukasz. If all developers can compile KMyMoney I am all in. I would not worry about the distros because until we can release this version this won't be an issue anymore.

I would be too, but on my stock openSUSE Leap 42.2 which I installed just a few weeks ago from scratch, I have

thb@thb-nb:~/bin$ g++ --version
g++ (SUSE Linux) 4.8.5
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

and using the proposed change does not work. Not sure if there is a newer version available and how I would install and not brake anything.

Have you tried switching to gcc5 after installing gcc5?

Have you tried switching to gcc5 after installing gcc5?

I just did that after I found out that it does not upgrade automatically but a version is available (even for gcc6). After switching the -strd=c++14 option works w/o problems.

wojnilowicz edited edge metadata.

MSVC switch remains as it seems that this compiler doesn't support standards version switches

wojnilowicz planned changes to this revision.Jun 28 2017, 4:34 PM
wojnilowicz added a subscriber: conet.

I am with Łukasz. If all developers can compile KMyMoney I am all in. I would not worry about the distros because until we can release this version this won't be an issue anymore.

I would be too, but [...]

It seems that the change should return. I wonder whether Cristian can compile on c++14.

wojnilowicz requested review of this revision.Jun 28 2017, 5:04 PM

[…]
and using the proposed change does not work. Not sure if there is a newer version available and how I would install and not brake anything.

Maybe you need to set CMAKE_<LANG>_COMPILER to /usr/bin/g++-5 (or so).

CMakeLists.txt
65

Yes. MSVC does not know this switch, so it will generate a warning for every invocation (about the number of .cpp files we have). MSVC always compiles with all features it knows (which can be C++17 or any Microsoft specific addition).

66

This comment refers to CMake's compile features. They should make the compiler flag settings compiler (and compiler version) independent (note: the option -std=c++** works probably only for GCC and clang – and we can be happy that this are two compilers already).

tbaumgart accepted this revision as: tbaumgart.Jul 6 2017, 12:02 PM
This revision was automatically updated to reflect the committed changes.
kfunk added a subscriber: kfunk.Jul 6 2017, 4:29 PM

Do you *depend* on C++14? If not, then this change is quite... unnecessary and only causes trouble for packagers / people attempting to build KMyMoney on older distros.

In D6384#122293, @kfunk wrote:

Do you *depend* on C++14? If not, then this change is quite... unnecessary and only causes trouble for packagers / people attempting to build KMyMoney on older distros.

Nobody depends on C++14 but it would be nice to finally start using it. See earlier considerations on this page about older distros.

kfunk added a comment.Jul 6 2017, 4:46 PM
In D6384#122293, @kfunk wrote:

Do you *depend* on C++14? If not, then this change is quite... unnecessary and only causes trouble for packagers / people attempting to build KMyMoney on older distros.

Nobody depends on C++14 but it would be nice to finally start using it. See earlier considerations on this page about older distros.

I don't find these arguments particular convincing. Ubuntu 14.04 LTS is another popular distro people are using, which is also featuring GCC 4.8 (=> no C++14 support). People need to upgrade their compiler toolchain in case they want to compile your project. Every now and then I see people popping up in KDevelop who tell me that the KDevelop build is broken on Ubuntu 14.04 LTS b/c of various reasons -- easy to fix usually. So there's a couple of people indeed using that as a development platform to work on KDE projects. And I'd rather not lose them as potential contributors for my project. Just my 2c, I'm not involved in the KMyMoney project after all. /me hides again.

In D6384#122314, @kfunk wrote:
In D6384#122293, @kfunk wrote:

Do you *depend* on C++14? If not, then this change is quite... unnecessary and only causes trouble for packagers / people attempting to build KMyMoney on older distros.

Nobody depends on C++14 but it would be nice to finally start using it. See earlier considerations on this page about older distros.

I don't find these arguments particular convincing. Ubuntu 14.04 LTS is another popular distro people are using, which is also featuring GCC 4.8 (=> no C++14 support). People need to upgrade their compiler toolchain in case they want to compile your project. Every now and then I see people popping up in KDevelop who tell me that the KDevelop build is broken on Ubuntu 14.04 LTS b/c of various reasons -- easy to fix usually. So there's a couple of people indeed using that as a development platform to work on KDE projects. And I'd rather not lose them as potential contributors for my project. Just my 2c, I'm not involved in the KMyMoney project after all. /me hides again.

It's beyond my grasp. If Ubuntu 14.04 LTS sticks with old software, then why would they like to compile our new software. They stick with it not without a reason.
It seems too me that they wouldn't be interested in our development.
Besides KMM requires Qt 5.6 and they have only Qt 5.2 so they are already out of reach.