Skip to content

Commit cf48887

Browse files
Dominik Loidoltgitster
authored andcommitted
compat/posix.h: simplify GIT_GNUC_PREREQ() comparison
GIT_GNUC_PREREQ() uses a glibc-style bit-shift version comparison, which is harder to read than an explicit major/minor comparison. Use an explicit comparison, as in many BSD <sys/cdefs.h> headers, and drop the Linux header attribution comment because it no longer applies. Signed-off-by: Dominik Loidolt <dominik.loidolt@univie.ac.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent ffd4592 commit cf48887

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

compat/posix.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#define _FILE_OFFSET_BITS 64
55

66
/*
7-
* Derived from Linux "Features Test Macro" header
87
* Convenience macros to test the versions of GCC (or a compatible compiler).
98
* Use them like this:
109
* #if GIT_GNUC_PREREQ (2,8)
@@ -19,7 +18,8 @@
1918
*/
2019
#if defined(__GNUC__) && defined(__GNUC_MINOR__)
2120
# define GIT_GNUC_PREREQ(maj, min) \
22-
((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
21+
((__GNUC__ > (maj)) || \
22+
(__GNUC__ == (maj) && __GNUC_MINOR__ >= (min)))
2323
#else
2424
# define GIT_GNUC_PREREQ(maj, min) 0
2525
#endif

0 commit comments

Comments
 (0)