*: 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.
This commit is contained in:
parent
86a0a42a8d
commit
59e4f1ee0f
|
@ -46,19 +46,11 @@ StatsVisitTag(DatabaseStats &stats, StringSet &artists, StringSet &albums,
|
|||
for (const auto &item : tag) {
|
||||
switch (item.type) {
|
||||
case TAG_ARTIST:
|
||||
#if CLANG_OR_GCC_VERSION(4,8)
|
||||
artists.emplace(item.value);
|
||||
#else
|
||||
artists.insert(item.value);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case TAG_ALBUM:
|
||||
#if CLANG_OR_GCC_VERSION(4,8)
|
||||
albums.emplace(item.value);
|
||||
#else
|
||||
albums.insert(item.value);
|
||||
#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -625,11 +625,7 @@ UpnpDatabase::VisitUniqueTags(const DatabaseSelection &selection,
|
|||
|
||||
const char *value = dirent.tag.GetValue(tag);
|
||||
if (value != nullptr) {
|
||||
#if CLANG_OR_GCC_VERSION(4,8)
|
||||
values.emplace(value);
|
||||
#else
|
||||
values.insert(value);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -212,14 +212,7 @@ SmbclientNeighborExplorer::Run()
|
|||
prev = i;
|
||||
} else {
|
||||
/* can't see it anymore: move to "lost" */
|
||||
#if CLANG_OR_GCC_VERSION(4,7)
|
||||
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:
|
|||
static HttpdOutput *Create(EventLoop &event_loop,
|
||||
const ConfigBlock &block);
|
||||
|
||||
#if CLANG_OR_GCC_VERSION(4,7)
|
||||
constexpr
|
||||
#endif
|
||||
static HttpdOutput *Cast(AudioOutput *ao) {
|
||||
static constexpr HttpdOutput *Cast(AudioOutput *ao) {
|
||||
return &ContainerCast(*ao, &HttpdOutput::base);
|
||||
}
|
||||
|
||||
|
|
|
@ -130,13 +130,8 @@ CompositeStorage::Directory::Make(const char *uri)
|
|||
Directory *directory = this;
|
||||
while (*uri != 0) {
|
||||
const std::string name = NextSegment(uri);
|
||||
#if CLANG_OR_GCC_VERSION(4,8)
|
||||
auto i = directory->children.emplace(std::move(name),
|
||||
Directory());
|
||||
#else
|
||||
auto i = directory->children.insert(std::make_pair(std::move(name),
|
||||
Directory()));
|
||||
#endif
|
||||
directory = &i.first->second;
|
||||
}
|
||||
|
||||
|
|
|
@ -90,10 +90,7 @@ calc_hash(TagType type, const char *p)
|
|||
return hash ^ type;
|
||||
}
|
||||
|
||||
#if CLANG_OR_GCC_VERSION(4,7)
|
||||
constexpr
|
||||
#endif
|
||||
static inline TagPoolSlot *
|
||||
static inline constexpr TagPoolSlot *
|
||||
tag_item_to_slot(TagItem *item)
|
||||
{
|
||||
return &ContainerCast(*item, &TagPoolSlot::item);
|
||||
|
|
|
@ -76,11 +76,7 @@ TagSet::InsertUnique(const Tag &src, TagType type, const char *value,
|
|||
else
|
||||
builder.AddItem(type, value);
|
||||
CopyTagMask(builder, src, group_mask);
|
||||
#if CLANG_OR_GCC_VERSION(4,8)
|
||||
emplace(builder.Commit());
|
||||
#else
|
||||
insert(builder.Commit());
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -76,8 +76,6 @@ xstrndup(const char *s, size_t n)
|
|||
return p;
|
||||
}
|
||||
|
||||
#if CLANG_OR_GCC_VERSION(4,7)
|
||||
|
||||
template<typename... Args>
|
||||
static inline size_t
|
||||
FillLengths(size_t *lengths, const char *a, Args&&... args)
|
||||
|
@ -107,14 +105,11 @@ StringCat(char *p, const size_t *lengths, const char *a)
|
|||
memcpy(p, a, *lengths);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
template<typename... Args>
|
||||
gcc_malloc gcc_nonnull_all
|
||||
static inline char *
|
||||
t_xstrcatdup(Args&&... args)
|
||||
{
|
||||
#if CLANG_OR_GCC_VERSION(4,7)
|
||||
constexpr size_t n = sizeof...(args);
|
||||
|
||||
size_t lengths[n];
|
||||
|
@ -124,22 +119,6 @@ t_xstrcatdup(Args&&... args)
|
|||
StringCat(p, lengths, args...);
|
||||
p[total] = 0;
|
||||
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 *
|
||||
|
|
|
@ -84,10 +84,7 @@ ContainerAttributeOffset(const A C::*p)
|
|||
* Cast the given pointer to a struct member to its parent structure.
|
||||
*/
|
||||
template<class C, class A>
|
||||
#if CLANG_OR_GCC_VERSION(4,7)
|
||||
constexpr
|
||||
#endif
|
||||
static inline C &
|
||||
static inline constexpr C &
|
||||
ContainerCast(A &a, A C::*member)
|
||||
{
|
||||
return *OffsetCast<C, A>(&a, ContainerAttributeOffset<C, A>(member));
|
||||
|
@ -97,10 +94,7 @@ ContainerCast(A &a, A C::*member)
|
|||
* Cast the given pointer to a struct member to its parent structure.
|
||||
*/
|
||||
template<class C, class A>
|
||||
#if CLANG_OR_GCC_VERSION(4,7)
|
||||
constexpr
|
||||
#endif
|
||||
static inline const C &
|
||||
static inline constexpr const C &
|
||||
ContainerCast(const A &a, A C::*member)
|
||||
{
|
||||
return *OffsetCast<const C, const A>(&a, ContainerAttributeOffset<C, A>(member));
|
||||
|
|
Loading…
Reference in New Issue