configure.ac: enable C++14

This commit is contained in:
Max Kellermann
2016-11-18 08:41:47 +01:00
parent b0b8f573bc
commit 2f76f9da89
9 changed files with 607 additions and 152 deletions

View File

@@ -20,19 +20,10 @@
#ifndef MPD_CHRONO_HXX
#define MPD_CHRONO_HXX
#include "Compiler.h"
#include <chrono>
#include <utility>
#include <cstdint>
#if GCC_OLDER_THAN(4,7)
/* std::chrono::duration operators are "constexpr" since gcc 4.7 */
#define chrono_constexpr gcc_pure
#else
#define chrono_constexpr constexpr
#endif
/**
* A time stamp within a song. Granularity is 1 millisecond and the
* maximum value is about 49 days.
@@ -108,11 +99,11 @@ public:
return count() > 0;
}
chrono_constexpr SongTime operator+(const SongTime &other) const {
constexpr SongTime operator+(const SongTime &other) const {
return SongTime(*(const Base *)this + (const Base &)other);
}
chrono_constexpr SongTime operator-(const SongTime &other) const {
constexpr SongTime operator-(const SongTime &other) const {
return SongTime(*(const Base *)this - (const Base &)other);
}
};
@@ -212,15 +203,13 @@ public:
return count() < 0;
}
chrono_constexpr SignedSongTime operator+(const SignedSongTime &other) const {
constexpr SignedSongTime operator+(const SignedSongTime &other) const {
return SignedSongTime(*(const Base *)this + (const Base &)other);
}
chrono_constexpr SignedSongTime operator-(const SignedSongTime &other) const {
constexpr SignedSongTime operator-(const SignedSongTime &other) const {
return SignedSongTime(*(const Base *)this - (const Base &)other);
}
};
#undef chrono_constexpr
#endif

View File

@@ -62,8 +62,8 @@
# error Sorry, your clang version is too old. You need at least version 3.1.
# endif
#elif defined(__GNUC__)
# if GCC_OLDER_THAN(4,7)
# error Sorry, your gcc version is too old. You need at least version 4.6.
# if GCC_OLDER_THAN(4,9)
# error Sorry, your gcc version is too old. You need at least version 4.9.
# endif
#else
# warning Untested compiler. Use at your own risk!
@@ -97,8 +97,6 @@
#define gcc_likely(x) __builtin_expect (!!(x), 1)
#define gcc_unlikely(x) __builtin_expect (!!(x), 0)
#define gcc_aligned(n) __attribute__((aligned(n)))
#define gcc_visibility_hidden __attribute__((visibility("hidden")))
#define gcc_visibility_default __attribute__((visibility("default")))
@@ -126,8 +124,6 @@
#define gcc_likely(x) (x)
#define gcc_unlikely(x) (x)
#define gcc_aligned(n)
#define gcc_visibility_hidden
#define gcc_visibility_default
@@ -168,17 +164,7 @@
#if defined(__cplusplus)
/* support for C++11 "override" was added in gcc 4.7 */
#if GCC_OLDER_THAN(4,7)
#define override
#define final
#endif
#if CLANG_OR_GCC_VERSION(4,8)
#define gcc_alignas(T, fallback) alignas(T)
#else
#define gcc_alignas(T, fallback) gcc_aligned(fallback)
#endif
#endif

View File

@@ -35,10 +35,6 @@
#include <new>
#include <utility>
#if GCC_OLDER_THAN(4,8)
#include <type_traits>
#endif
#include <assert.h>
#if CLANG_OR_GCC_VERSION(4,7)