Require C++14

Summary:
KWin already used C++14 constructs in a conditional way. This doesn't
make much sense today, it's better to just require C++14.

For KWin only gcc and clang are currently compilers of relevance. Gcc
supports C++14 since version 5 and defaults to C++14 since 6.1 [1].
Clang supports C++14 since version 3.4 [2].

An overview of compiler support in various distributions:
* Debian stable (stretch): gcc 6.3, clang 3.8
* Debian oldstable (jessie): 4.9, clang 3.5
* Ubuntu 17.04: gcc 6.1, clang 3.8
* Ubuntu 16.04: gcc 5.3, clang 3.8
* openSUSE Tumbleweed: gcc 7.1, clang 4.0
* openSUSE Leap 42.3: gcc ?, clang ? [3]
* FreeBSD: clang >= 34 in ports
* Slackware 14.2: gcc 5.3

This overview shows that every distro out there has at least one
supported compiler which can still compile KWin with this change.

[1] https://gcc.gnu.org/projects/cxx-status.html#cxx14
[2] https://clang.llvm.org/cxx_status
[3] Sorry I fail to understand openSUSE's package repository.
    It seems that there is gcc 7 available, but gcc package is 4.8

Test Plan: Compiles on my neon system

Reviewers: #plasma

Subscribers: plasma-devel, kwin, #kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D6634
This commit is contained in:
Martin Flöser 2017-07-11 20:08:50 +02:00
parent 8e2805ce9d
commit ea5d611de1
2 changed files with 2 additions and 12 deletions

View file

@ -48,7 +48,7 @@ include(ECMOptionalAddSubdirectory)
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0 -DQT_USE_QSTRINGBUILDER) add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0 -DQT_USE_QSTRINGBUILDER)
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(Qt5Multimedia QUIET) find_package(Qt5Multimedia QUIET)

View file

@ -69,17 +69,7 @@ typedef struct xcb_glx_buffer_swap_complete_event_t {
#endif #endif
#include <tuple> #include <tuple>
#include <memory>
#if __cplusplus <= 201103L
namespace std {
// C++-14
template<class T, class... Args>
unique_ptr<T> make_unique(Args&&... args) {
return unique_ptr<T>(new T(std::forward<Args>(args)...));
}
}
#endif
namespace KWin namespace KWin
{ {