git-compat-util.h: GCC deprecated message arg only in GCC 4.5+

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 <asedeno@mit.edu> Signed-off-by: Alejandro R Sedeño <asedeno@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Alejandro R. Sedeño committed Oct 5, 2022 at 18:19 UTC 7c07f36ad20ff206f6ed1a5609b295ec471b6cca
1 file changed +4 -1
git-compat-util.h
+4 -1
@@ -189,9 +189,12 @@ struct strbuf;
189 #define _NETBSD_SOURCE 1
190 #define _SGI_SOURCE 1
191
192 -#if defined(__GNUC__)
192 +#if GIT_GNUC_PREREQ(4, 5)
193 #define UNUSED __attribute__((unused)) \
194 __attribute__((deprecated ("parameter declared as UNUSED")))
195 +#elif defined(__GNUC__)
196 +#define UNUSED __attribute__((unused)) \
197 + __attribute__((deprecated))
198 #else
199 #define UNUSED
200 #endif