From owner-svn-src-all@freebsd.org Sat Dec 14 21:52:50 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 385C01D7E32; Sat, 14 Dec 2019 21:52:50 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47b1VV0W1Kz3JPs; Sat, 14 Dec 2019 21:52:50 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0CCA8306C; Sat, 14 Dec 2019 21:52:50 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBELqnEv005847; Sat, 14 Dec 2019 21:52:49 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBELqnYJ005845; Sat, 14 Dec 2019 21:52:49 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201912142152.xBELqnYJ005845@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sat, 14 Dec 2019 21:52:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355759 - in head: include sys/sys X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head: include sys/sys X-SVN-Commit-Revision: 355759 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Dec 2019 21:52:50 -0000 Author: cem Date: Sat Dec 14 21:52:49 2019 New Revision: 355759 URL: https://svnweb.freebsd.org/changeset/base/355759 Log: 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 Modified: head/include/stdlib.h head/sys/sys/cdefs.h Modified: head/include/stdlib.h ============================================================================== --- head/include/stdlib.h Sat Dec 14 21:49:47 2019 (r355758) +++ head/include/stdlib.h Sat Dec 14 21:52:49 2019 (r355759) @@ -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) { } Modified: head/sys/sys/cdefs.h ============================================================================== --- head/sys/sys/cdefs.h Sat Dec 14 21:49:47 2019 (r355758) +++ head/sys/sys/cdefs.h Sat Dec 14 21:52:49 2019 (r355759) @@ -468,6 +468,14 @@ #define __hidden #endif +#if __GNUC__ > 4 || defined(__clang__) +#define __deprecated(m) __attribute__((__deprecated__(m))) +#elif defined(__GNUC__) +#define __deprecated(m) __attribute__((__deprecated__)) +#else +#define __deprecated(m) +#endif + /* * We define this here since , , and * require it.