summaryrefslogtreecommitdiff
path: root/git-compat-util.h
diff options
context:
space:
mode:
authorAlejandro R. Sedeño <asedeno@mit.edu>2022-10-05 22:19:28 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-10-06 02:09:59 (GMT)
commit7c07f36ad20ff206f6ed1a5609b295ec471b6cca (patch)
treecaf99f2254f2936f6a5d4d352458c010aacd70e2 /git-compat-util.h
parent9ff7eb8c8882c477919acfe28a3d68bb58adf2ea (diff)
downloadgit-7c07f36ad20ff206f6ed1a5609b295ec471b6cca.zip
git-7c07f36ad20ff206f6ed1a5609b295ec471b6cca.tar.gz
git-7c07f36ad20ff206f6ed1a5609b295ec471b6cca.tar.bz2
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>
Diffstat (limited to 'git-compat-util.h')
-rw-r--r--git-compat-util.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/git-compat-util.h b/git-compat-util.h
index 71a004b..06e647e 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