Commit 59e4f1ee authored by Max Kellermann's avatar Max Kellermann

*: remove lots of GCC 4.8 fallback code

We can remove those C++11 and C++14 kludges because we require GCC 4.9 now.
parent 86a0a42a
...@@ -46,19 +46,11 @@ StatsVisitTag(DatabaseStats &stats, StringSet &artists, StringSet &albums, ...@@ -46,19 +46,11 @@ StatsVisitTag(DatabaseStats &stats, StringSet &artists, StringSet &albums,
for (const auto &item : tag) { for (const auto &item : tag) {
switch (item.type) { switch (item.type) {
case TAG_ARTIST: case TAG_ARTIST:
#if CLANG_OR_GCC_VERSION(4,8)
artists.emplace(item.value); artists.emplace(item.value);
#else
artists.insert(item.value);
#endif
break; break;
case TAG_ALBUM: case TAG_ALBUM:
#if CLANG_OR_GCC_VERSION(4,8)
albums.emplace(item.value); albums.emplace(item.value);
#else
albums.insert(item.value);
#endif
break; break;
default: default:
......
...@@ -625,11 +625,7 @@ UpnpDatabase::VisitUniqueTags(const DatabaseSelection &selection, ...@@ -625,11 +625,7 @@ UpnpDatabase::VisitUniqueTags(const DatabaseSelection &selection,
const char *value = dirent.tag.GetValue(tag); const char *value = dirent.tag.GetValue(tag);
if (value != nullptr) { if (value != nullptr) {
#if CLANG_OR_GCC_VERSION(4,8)
values.emplace(value); values.emplace(value);
#else
values.insert(value);
#endif
} }
} }
} }
......
...@@ -212,14 +212,7 @@ SmbclientNeighborExplorer::Run() ...@@ -212,14 +212,7 @@ SmbclientNeighborExplorer::Run()
prev = i; prev = i;
} else { } else {
/* can't see it anymore: move to "lost" */ /* can't see it anymore: move to "lost" */
#if CLANG_OR_GCC_VERSION(4,7)
lost.splice_after(lost.before_begin(), list, prev); lost.splice_after(lost.before_begin(), list, prev);
#else
/* the forward_list::splice_after() lvalue
reference overload is missing in gcc 4.6 */
lost.emplace_front(std::move(*i));
list.erase_after(prev);
#endif
} }
} }
......
...@@ -158,10 +158,7 @@ public: ...@@ -158,10 +158,7 @@ public:
static HttpdOutput *Create(EventLoop &event_loop, static HttpdOutput *Create(EventLoop &event_loop,
const ConfigBlock &block); const ConfigBlock &block);
#if CLANG_OR_GCC_VERSION(4,7) static constexpr HttpdOutput *Cast(AudioOutput *ao) {
constexpr
#endif
static HttpdOutput *Cast(AudioOutput *ao) {
return &ContainerCast(*ao, &HttpdOutput::base); return &ContainerCast(*ao, &HttpdOutput::base);
} }
......
...@@ -130,13 +130,8 @@ CompositeStorage::Directory::Make(const char *uri) ...@@ -130,13 +130,8 @@ CompositeStorage::Directory::Make(const char *uri)
Directory *directory = this; Directory *directory = this;
while (*uri != 0) { while (*uri != 0) {
const std::string name = NextSegment(uri); const std::string name = NextSegment(uri);
#if CLANG_OR_GCC_VERSION(4,8)
auto i = directory->children.emplace(std::move(name), auto i = directory->children.emplace(std::move(name),
Directory()); Directory());
#else
auto i = directory->children.insert(std::make_pair(std::move(name),
Directory()));
#endif
directory = &i.first->second; directory = &i.first->second;
} }
......
...@@ -90,10 +90,7 @@ calc_hash(TagType type, const char *p) ...@@ -90,10 +90,7 @@ calc_hash(TagType type, const char *p)
return hash ^ type; return hash ^ type;
} }
#if CLANG_OR_GCC_VERSION(4,7) static inline constexpr TagPoolSlot *
constexpr
#endif
static inline TagPoolSlot *
tag_item_to_slot(TagItem *item) tag_item_to_slot(TagItem *item)
{ {
return &ContainerCast(*item, &TagPoolSlot::item); return &ContainerCast(*item, &TagPoolSlot::item);
......
...@@ -76,11 +76,7 @@ TagSet::InsertUnique(const Tag &src, TagType type, const char *value, ...@@ -76,11 +76,7 @@ TagSet::InsertUnique(const Tag &src, TagType type, const char *value,
else else
builder.AddItem(type, value); builder.AddItem(type, value);
CopyTagMask(builder, src, group_mask); CopyTagMask(builder, src, group_mask);
#if CLANG_OR_GCC_VERSION(4,8)
emplace(builder.Commit()); emplace(builder.Commit());
#else
insert(builder.Commit());
#endif
} }
bool bool
......
...@@ -76,8 +76,6 @@ xstrndup(const char *s, size_t n) ...@@ -76,8 +76,6 @@ xstrndup(const char *s, size_t n)
return p; return p;
} }
#if CLANG_OR_GCC_VERSION(4,7)
template<typename... Args> template<typename... Args>
static inline size_t static inline size_t
FillLengths(size_t *lengths, const char *a, Args&&... args) FillLengths(size_t *lengths, const char *a, Args&&... args)
...@@ -107,14 +105,11 @@ StringCat(char *p, const size_t *lengths, const char *a) ...@@ -107,14 +105,11 @@ StringCat(char *p, const size_t *lengths, const char *a)
memcpy(p, a, *lengths); memcpy(p, a, *lengths);
} }
#endif
template<typename... Args> template<typename... Args>
gcc_malloc gcc_nonnull_all gcc_malloc gcc_nonnull_all
static inline char * static inline char *
t_xstrcatdup(Args&&... args) t_xstrcatdup(Args&&... args)
{ {
#if CLANG_OR_GCC_VERSION(4,7)
constexpr size_t n = sizeof...(args); constexpr size_t n = sizeof...(args);
size_t lengths[n]; size_t lengths[n];
...@@ -124,22 +119,6 @@ t_xstrcatdup(Args&&... args) ...@@ -124,22 +119,6 @@ t_xstrcatdup(Args&&... args)
StringCat(p, lengths, args...); StringCat(p, lengths, args...);
p[total] = 0; p[total] = 0;
return p; return p;
#else
/* fallback implementation for gcc 4.6, because that old
compiler is too buggy to compile the above template
functions */
const char *const argv[] = { args... };
size_t total = 0;
for (auto i : argv)
total += strlen(i);
char *p = (char *)xalloc(total + 1), *q = p;
for (auto i : argv)
q = stpcpy(q, i);
return p;
#endif
} }
char * char *
......
...@@ -84,10 +84,7 @@ ContainerAttributeOffset(const A C::*p) ...@@ -84,10 +84,7 @@ ContainerAttributeOffset(const A C::*p)
* Cast the given pointer to a struct member to its parent structure. * Cast the given pointer to a struct member to its parent structure.
*/ */
template<class C, class A> template<class C, class A>
#if CLANG_OR_GCC_VERSION(4,7) static inline constexpr C &
constexpr
#endif
static inline C &
ContainerCast(A &a, A C::*member) ContainerCast(A &a, A C::*member)
{ {
return *OffsetCast<C, A>(&a, ContainerAttributeOffset<C, A>(member)); return *OffsetCast<C, A>(&a, ContainerAttributeOffset<C, A>(member));
...@@ -97,10 +94,7 @@ ContainerCast(A &a, A C::*member) ...@@ -97,10 +94,7 @@ ContainerCast(A &a, A C::*member)
* Cast the given pointer to a struct member to its parent structure. * Cast the given pointer to a struct member to its parent structure.
*/ */
template<class C, class A> template<class C, class A>
#if CLANG_OR_GCC_VERSION(4,7) static inline constexpr const C &
constexpr
#endif
static inline const C &
ContainerCast(const A &a, A C::*member) ContainerCast(const A &a, A C::*member)
{ {
return *OffsetCast<const C, const A>(&a, ContainerAttributeOffset<C, A>(member)); return *OffsetCast<const C, const A>(&a, ContainerAttributeOffset<C, A>(member));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment