Skip to content

Commit 7c07f36

Browse files
asedenogitster
authored andcommitted
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 <[email protected]> Signed-off-by: Alejandro R Sedeño <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9ff7eb8 commit 7c07f36

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

git-compat-util.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,12 @@ struct strbuf;
189189
#define _NETBSD_SOURCE 1
190190
#define _SGI_SOURCE 1
191191

192-
#if defined(__GNUC__)
192+
#if GIT_GNUC_PREREQ(4, 5)
193193
#define UNUSED __attribute__((unused)) \
194194
__attribute__((deprecated ("parameter declared as UNUSED")))
195+
#elif defined(__GNUC__)
196+
#define UNUSED __attribute__((unused)) \
197+
__attribute__((deprecated))
195198
#else
196199
#define UNUSED
197200
#endif

0 commit comments

Comments
 (0)