From 7c07f36ad20ff206f6ed1a5609b295ec471b6cca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20R=2E=20Sede=C3=B1o?= Date: Wed, 5 Oct 2022 18:19:28 -0400 Subject: git-compat-util.h: GCC deprecated message arg only in GCC 4.5+ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://gcc.gnu.org/gcc-4.5/changes.html says The deprecated attribute now takes an optional string argument, for example, __attribute__((deprecated("text string"))), that will be printed together with the deprecation warning. While GCC 4.5 is already 12 years old, git checks for even older versions in places. Let's not needlessly break older compilers when a small and simple fix is readily available. Signed-off-by: Alejandro R. Sedeño Signed-off-by: Alejandro R Sedeño Signed-off-by: Junio C Hamano --- git-compat-util.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'git-compat-util.h') diff --git a/git-compat-util.h b/git-compat-util.h index 71a004be40..06e647ee49 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -189,9 +189,12 @@ struct strbuf; #define _NETBSD_SOURCE 1 #define _SGI_SOURCE 1 -#if defined(__GNUC__) +#if GIT_GNUC_PREREQ(4, 5) #define UNUSED __attribute__((unused)) \ __attribute__((deprecated ("parameter declared as UNUSED"))) +#elif defined(__GNUC__) +#define UNUSED __attribute__((unused)) \ + __attribute__((deprecated)) #else #define UNUSED #endif -- cgit v1.2.3