strdupa.h: #error if building with non-GCC on non-GNU systems

At the moment only GCC is supported on non-GNU systems, unfortunately.
GNU systems usually have GLIBC, or another library with strdupa().  This
strdupa() implementation requires GCC for the builtin alloca API.

Followup to pull-request #4

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2016-06-02 19:51:43 +02:00
parent 113c3487bd
commit 59869b876e
+2 -1
View File
@@ -37,7 +37,6 @@
#if !HAVE_STRDUPA
#if defined(__GNUC__)
#include <stddef.h> /* size_t */
#include <string.h> /* memcpy(3) strlen(3) */
#define strdupa(src) (__extension__ ({ \
@@ -47,6 +46,8 @@
(char *)memcpy(dst_, src, len_); \
}))
#else /* If not GCC, e.g. Clang */
#error strdupa() may use an unsupported GNU C API, please forward any fix to maintainer, cheers!
#endif /* __GNUC__ */
#endif /* !HAVE_STRDUPA */