summaryrefslogtreecommitdiff
path: root/common/compat.h
diff options
context:
space:
mode:
authorStef Walter <stef@thewalter.net>2013-07-23 23:02:52 +0200
committerStef Walter <stef@thewalter.net>2013-07-23 23:06:30 +0200
commit6b457ffc260100e0e3e6b2143b00e34bb419665e (patch)
treefd822c97a135686895c9c8fee097cdabb18be497 /common/compat.h
parentb14fc0351c4dd71c5ca71df77e325d2b2a4c0583 (diff)
downloadp11-kit-6b457ffc260100e0e3e6b2143b00e34bb419665e.tar.gz
Don't use _GNU_SOURCE and fix strerror_r usage
glibc declares strerror_r completely different if in POSIX or GNU mode. Nastiness. Stop using _GNU_SOURCE all together.
Diffstat (limited to 'common/compat.h')
-rw-r--r--common/compat.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/common/compat.h b/common/compat.h
index 5b76d00..b593cf6 100644
--- a/common/compat.h
+++ b/common/compat.h
@@ -39,6 +39,10 @@
#include <sys/types.h>
+#ifdef _GNU_SOURCE
+#error Make the crap stop. _GNU_SOURCE is completely unportable and breaks all sorts of behavior
+#endif
+
#if !defined(__cplusplus) && (__GNUC__ > 2)
#define GNUC_PRINTF(x, y) __attribute__((__format__(__printf__, x, y)))
#else
@@ -266,7 +270,7 @@ char * strconcat (const char *first,
#endif /* HAVE_STRCONCAT */
-#ifndef HAVE_ASPRINTF
+#if defined HAVE_DECL_ASPRINTF && !HAVE_DECL_ASPRINTF
int asprintf (char **strp,
const char *fmt,
@@ -274,14 +278,14 @@ int asprintf (char **strp,
#endif /* HAVE_ASPRINTF */
-#ifndef HAVE_VASPRINTF
+#if defined HAVE_DECL_VASPRINTF && !HAVE_DECL_VASPRINTF
#include <stdarg.h>
int vasprintf (char **strp,
const char *fmt,
va_list ap);
-#endif /* HAVE_VASPRINTF */
+#endif /* HAVE_DECL_VASPRINTF */
#ifndef HAVE_GMTIME_R
#include <time.h>