*: 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:
@@ -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));
|
||||
|
Reference in New Issue
Block a user