]> git.ipfire.org Git - thirdparty/libbsd.git/commitdiff
Support GCC deprecated attribute for GCC older than 4.5
authorGuillem Jover <guillem@hadrons.org>
Tue, 10 Jan 2017 03:24:35 +0000 (04:24 +0100)
committerGuillem Jover <guillem@hadrons.org>
Mon, 5 Jun 2017 03:51:52 +0000 (05:51 +0200)
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=99190
Based-on-patch-by: Eric Smith <brouhaha@fedoraproject.org>
include/bsd/stdio.h
include/bsd/sys/cdefs.h

index 7697425e1bc3ef89dd0971de1a32dd0a18d9f653..4b699832c02231ef77f06f8698a205ca8cdf1686 100644 (file)
 #ifndef LIBBSD_STDIO_H
 #define LIBBSD_STDIO_H
 
+#ifdef LIBBSD_OVERLAY
 #include <sys/cdefs.h>
+#else
+#include <bsd/sys/cdefs.h>
+#endif
 #include <sys/types.h>
 
 __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,
index 4b1063acb015e1fda200f350431c1883e3d5fd03..75d395563c81c6e01aa758dfa96104662938bdcf 100644 (file)
 #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__))