From 215332ffe75cf16b742e2b74dfefd0592c49eb63 Mon Sep 17 00:00:00 2001 From: Conrad Meyer Date: Sat, 14 Dec 2019 21:52:49 +0000 Subject: cdefs: Add __deprecated(message) function attribute macro The legacy version of GCC4 currently in base does not support the parameterized form of this function attribute, as recent introduced in stdlib.h (r355747). As we have done for other function attributes with similar compatibility problems, add a version-compatibile definition in sys/cdefs.h. Note that Clang defines itself to be GCC 4, so one must check for __clang__ in addition to __GNUC__ version. On legacy GCC 4, the macro expands to just the __deprecated__ attribute; on modern GCC or Clang, the macro expands to the parameterized variant with the message. Ignoring legacy or unsupported compilers, the macro is also beneficial in that it is a bit more ergonomic than the full __attribute__((__deprecated__())) boilerplate. Reported by: CI (but not tinderbox); imp and others Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D22817 --- include/stdlib.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/stdlib.h b/include/stdlib.h index 50bda707a0d3..e46e473fabc4 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -315,7 +315,7 @@ long long /* Deprecated interfaces, to be removed. */ static inline void -__attribute__((__deprecated__("sranddev to be removed in FreeBSD 13"))) +__deprecated("sranddev to be removed in FreeBSD 13") sranddev(void) { } -- cgit v1.3