From: Guillem Jover Date: Tue, 10 Jan 2017 03:24:35 +0000 (+0100) Subject: Support GCC deprecated attribute for GCC older than 4.5 X-Git-Tag: 0.8.4~31 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=337e62027503aa6e09ca7adbe94cd7077f3241c3;p=thirdparty%2Flibbsd.git Support GCC deprecated attribute for GCC older than 4.5 Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=99190 Based-on-patch-by: Eric Smith --- diff --git a/include/bsd/stdio.h b/include/bsd/stdio.h index 7697425..4b69983 100644 --- a/include/bsd/stdio.h +++ b/include/bsd/stdio.h @@ -38,7 +38,11 @@ #ifndef LIBBSD_STDIO_H #define LIBBSD_STDIO_H +#ifdef LIBBSD_OVERLAY #include +#else +#include +#endif #include __BEGIN_DECLS @@ -47,9 +51,9 @@ const char *fmtcheck(const char *, const char *); /* XXX: The function requires cooperation from the system libc to store the * line buffer in the FILE struct itself. */ char *fgetln(FILE *fp, size_t *lenp) - __attribute__((deprecated("This functions cannot be safely ported, " - "use getline(3) instead, as it is supported " - "by GNU and POSIX.1-2008."))); + LIBBSD_DEPRECATED("This functions cannot be safely ported, " + "use getline(3) instead, as it is supported " + "by GNU and POSIX.1-2008."); /* * Note: We diverge from the FreeBSD, OpenBSD and DragonFlyBSD declarations, diff --git a/include/bsd/sys/cdefs.h b/include/bsd/sys/cdefs.h index 4b1063a..75d3955 100644 --- a/include/bsd/sys/cdefs.h +++ b/include/bsd/sys/cdefs.h @@ -49,6 +49,14 @@ #define LIBBSD_GCC_VERSION 0 #endif +#if LIBBSD_GCC_VERSION >= 0x0405 +#define LIBBSD_DEPRECATED(x) __attribute__((deprecated(x))) +#elif LIBBSD_GCC_VERSION >= 0x0301 +#define LIBBSD_DEPRECATED(x) __attribute__((deprecated)) +#else +#define LIBBSD_DEPRECATED(x) +#endif + #ifndef __dead2 # if LIBBSD_GCC_VERSION >= 0x0207 # define __dead2 __attribute__((__noreturn__))