210 lines
6.7 KiB
Diff
210 lines
6.7 KiB
Diff
From 21bbf3a53b8be9b3fe90bcdb66c7ded35bc3e344 Mon Sep 17 00:00:00 2001
|
|
From: "Dmitry V. Levin" <ldv@altlinux.org>
|
|
Date: Sat, 12 Sep 2020 08:00:00 +0000
|
|
Subject: [PATCH 156/162] Introduce GLIBC_PREREQ_GE and GLIBC_PREREQ_LT macros
|
|
|
|
* gcc_compat.h (GLIBC_PREREQ_GE, GLIBC_PREREQ_LT): New macros.
|
|
* tests/ipc_msg.c: Use GLIBC_PREREQ_LT instead of manual checking
|
|
for __GLIBC__ and __GLIBC_MINOR__.
|
|
* tests/readahead.c: Likewise.
|
|
---
|
|
gcc_compat.h | 15 +++++++++++++++
|
|
tests/ipc_msg.c | 9 +++------
|
|
tests/readahead.c | 16 ++++++----------
|
|
3 files changed, 24 insertions(+), 16 deletions(-)
|
|
|
|
diff --git a/gcc_compat.h b/gcc_compat.h
|
|
index 0525b5e..4c23ebc 100644
|
|
--- a/gcc_compat.h
|
|
+++ b/gcc_compat.h
|
|
@@ -23,6 +23,21 @@
|
|
# define CLANG_PREREQ(maj, min) 0
|
|
# endif
|
|
|
|
+# ifdef __GLIBC__
|
|
+# ifdef __GLIBC_MINOR__
|
|
+# define GLIBC_PREREQ_GE(maj, min) \
|
|
+ ((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min))
|
|
+# define GLIBC_PREREQ_LT(maj, min) \
|
|
+ ((__GLIBC__ << 16) + __GLIBC_MINOR__ < ((maj) << 16) + (min))
|
|
+# else /* !__GLIBC_MINOR__ */
|
|
+# define GLIBC_PREREQ_GE(maj, min) 0
|
|
+# define GLIBC_PREREQ_LT(maj, min) 1
|
|
+# endif
|
|
+# else /* !__GLIBC__ */
|
|
+# define GLIBC_PREREQ_GE(maj, min) 0
|
|
+# define GLIBC_PREREQ_LT(maj, min) 0
|
|
+# endif
|
|
+
|
|
# if !(GNUC_PREREQ(2, 0) || CLANG_PREREQ(1, 0))
|
|
# define __attribute__(x) /* empty */
|
|
# endif
|
|
diff --git a/tests/ipc_msg.c b/tests/ipc_msg.c
|
|
index 63bdd77..dd0f303 100644
|
|
--- a/tests/ipc_msg.c
|
|
+++ b/tests/ipc_msg.c
|
|
@@ -26,12 +26,9 @@
|
|
* which led to segmentation fault.
|
|
*/
|
|
#undef TEST_MSGCTL_BOGUS_ADDR
|
|
-#if defined __GLIBC__ && (defined POWERPC64 || defined POWERPC64LE)
|
|
-# if !(defined __GLIBC_MINOR__) \
|
|
- || ((__GLIBC__ << 16) + __GLIBC_MINOR__ < (2 << 16) + 23)
|
|
-# define TEST_MSGCTL_BOGUS_ADDR 0
|
|
-# endif
|
|
-#endif /* __GLIBC__ && (POWERPC64 || POWERPC64LE) */
|
|
+#if GLIBC_PREREQ_LT(2, 23) && (defined POWERPC64 || defined POWERPC64LE)
|
|
+# define TEST_MSGCTL_BOGUS_ADDR 0
|
|
+#endif
|
|
|
|
#ifndef TEST_MSGCTL_BOGUS_ADDR
|
|
# define TEST_MSGCTL_BOGUS_ADDR 1
|
|
diff --git a/tests/readahead.c b/tests/readahead.c
|
|
index 86d09b0..6f4b81e 100644
|
|
--- a/tests/readahead.c
|
|
+++ b/tests/readahead.c
|
|
@@ -11,24 +11,20 @@
|
|
|
|
#ifdef HAVE_READAHEAD
|
|
/* Check for glibc readahead argument passing bugs. */
|
|
-# ifdef __GLIBC__
|
|
/*
|
|
* glibc < 2.8 had an incorrect order of higher and lower parts of offset,
|
|
* see https://sourceware.org/bugzilla/show_bug.cgi?id=5208
|
|
*/
|
|
-# if !(defined __GLIBC_MINOR__ && \
|
|
- (__GLIBC__ << 16) + __GLIBC_MINOR__ >= (2 << 16) + 8)
|
|
-# undef HAVE_READAHEAD
|
|
-# endif /* glibc < 2.8 */
|
|
+# if GLIBC_PREREQ_LT(2, 8)
|
|
+# undef HAVE_READAHEAD
|
|
+# endif /* glibc < 2.8 */
|
|
/*
|
|
* glibc < 2.25 had an incorrect implementation on mips n64,
|
|
* see https://sourceware.org/bugzilla/show_bug.cgi?id=21026
|
|
*/
|
|
-# if defined LINUX_MIPSN64 && !(defined __GLIBC_MINOR__ && \
|
|
- (__GLIBC__ << 16) + __GLIBC_MINOR__ >= (2 << 16) + 25)
|
|
-# undef HAVE_READAHEAD
|
|
-# endif /* LINUX_MIPSN64 && glibc < 2.25 */
|
|
-# endif /* __GLIBC__ */
|
|
+# if GLIBC_PREREQ_LT(2, 25) && defined LINUX_MIPSN64
|
|
+# undef HAVE_READAHEAD
|
|
+# endif /* LINUX_MIPSN64 && glibc < 2.25 */
|
|
#endif /* HAVE_READAHEAD */
|
|
|
|
#ifdef HAVE_READAHEAD
|
|
diff --git a/tests-m32/ipc_msg.c b/tests-m32/ipc_msg.c
|
|
index 63bdd77..dd0f303 100644
|
|
--- a/tests-m32/ipc_msg.c
|
|
+++ b/tests-m32/ipc_msg.c
|
|
@@ -26,12 +26,9 @@
|
|
* which led to segmentation fault.
|
|
*/
|
|
#undef TEST_MSGCTL_BOGUS_ADDR
|
|
-#if defined __GLIBC__ && (defined POWERPC64 || defined POWERPC64LE)
|
|
-# if !(defined __GLIBC_MINOR__) \
|
|
- || ((__GLIBC__ << 16) + __GLIBC_MINOR__ < (2 << 16) + 23)
|
|
-# define TEST_MSGCTL_BOGUS_ADDR 0
|
|
-# endif
|
|
-#endif /* __GLIBC__ && (POWERPC64 || POWERPC64LE) */
|
|
+#if GLIBC_PREREQ_LT(2, 23) && (defined POWERPC64 || defined POWERPC64LE)
|
|
+# define TEST_MSGCTL_BOGUS_ADDR 0
|
|
+#endif
|
|
|
|
#ifndef TEST_MSGCTL_BOGUS_ADDR
|
|
# define TEST_MSGCTL_BOGUS_ADDR 1
|
|
diff --git a/tests-m32/readahead.c b/tests-m32/readahead.c
|
|
index 86d09b0..6f4b81e 100644
|
|
--- a/tests-m32/readahead.c
|
|
+++ b/tests-m32/readahead.c
|
|
@@ -11,24 +11,20 @@
|
|
|
|
#ifdef HAVE_READAHEAD
|
|
/* Check for glibc readahead argument passing bugs. */
|
|
-# ifdef __GLIBC__
|
|
/*
|
|
* glibc < 2.8 had an incorrect order of higher and lower parts of offset,
|
|
* see https://sourceware.org/bugzilla/show_bug.cgi?id=5208
|
|
*/
|
|
-# if !(defined __GLIBC_MINOR__ && \
|
|
- (__GLIBC__ << 16) + __GLIBC_MINOR__ >= (2 << 16) + 8)
|
|
-# undef HAVE_READAHEAD
|
|
-# endif /* glibc < 2.8 */
|
|
+# if GLIBC_PREREQ_LT(2, 8)
|
|
+# undef HAVE_READAHEAD
|
|
+# endif /* glibc < 2.8 */
|
|
/*
|
|
* glibc < 2.25 had an incorrect implementation on mips n64,
|
|
* see https://sourceware.org/bugzilla/show_bug.cgi?id=21026
|
|
*/
|
|
-# if defined LINUX_MIPSN64 && !(defined __GLIBC_MINOR__ && \
|
|
- (__GLIBC__ << 16) + __GLIBC_MINOR__ >= (2 << 16) + 25)
|
|
-# undef HAVE_READAHEAD
|
|
-# endif /* LINUX_MIPSN64 && glibc < 2.25 */
|
|
-# endif /* __GLIBC__ */
|
|
+# if GLIBC_PREREQ_LT(2, 25) && defined LINUX_MIPSN64
|
|
+# undef HAVE_READAHEAD
|
|
+# endif /* LINUX_MIPSN64 && glibc < 2.25 */
|
|
#endif /* HAVE_READAHEAD */
|
|
|
|
#ifdef HAVE_READAHEAD
|
|
diff --git a/tests-mx32/ipc_msg.c b/tests-mx32/ipc_msg.c
|
|
index 63bdd77..dd0f303 100644
|
|
--- a/tests-mx32/ipc_msg.c
|
|
+++ b/tests-mx32/ipc_msg.c
|
|
@@ -26,12 +26,9 @@
|
|
* which led to segmentation fault.
|
|
*/
|
|
#undef TEST_MSGCTL_BOGUS_ADDR
|
|
-#if defined __GLIBC__ && (defined POWERPC64 || defined POWERPC64LE)
|
|
-# if !(defined __GLIBC_MINOR__) \
|
|
- || ((__GLIBC__ << 16) + __GLIBC_MINOR__ < (2 << 16) + 23)
|
|
-# define TEST_MSGCTL_BOGUS_ADDR 0
|
|
-# endif
|
|
-#endif /* __GLIBC__ && (POWERPC64 || POWERPC64LE) */
|
|
+#if GLIBC_PREREQ_LT(2, 23) && (defined POWERPC64 || defined POWERPC64LE)
|
|
+# define TEST_MSGCTL_BOGUS_ADDR 0
|
|
+#endif
|
|
|
|
#ifndef TEST_MSGCTL_BOGUS_ADDR
|
|
# define TEST_MSGCTL_BOGUS_ADDR 1
|
|
diff --git a/tests-mx32/readahead.c b/tests-mx32/readahead.c
|
|
index 86d09b0..6f4b81e 100644
|
|
--- a/tests-mx32/readahead.c
|
|
+++ b/tests-mx32/readahead.c
|
|
@@ -11,24 +11,20 @@
|
|
|
|
#ifdef HAVE_READAHEAD
|
|
/* Check for glibc readahead argument passing bugs. */
|
|
-# ifdef __GLIBC__
|
|
/*
|
|
* glibc < 2.8 had an incorrect order of higher and lower parts of offset,
|
|
* see https://sourceware.org/bugzilla/show_bug.cgi?id=5208
|
|
*/
|
|
-# if !(defined __GLIBC_MINOR__ && \
|
|
- (__GLIBC__ << 16) + __GLIBC_MINOR__ >= (2 << 16) + 8)
|
|
-# undef HAVE_READAHEAD
|
|
-# endif /* glibc < 2.8 */
|
|
+# if GLIBC_PREREQ_LT(2, 8)
|
|
+# undef HAVE_READAHEAD
|
|
+# endif /* glibc < 2.8 */
|
|
/*
|
|
* glibc < 2.25 had an incorrect implementation on mips n64,
|
|
* see https://sourceware.org/bugzilla/show_bug.cgi?id=21026
|
|
*/
|
|
-# if defined LINUX_MIPSN64 && !(defined __GLIBC_MINOR__ && \
|
|
- (__GLIBC__ << 16) + __GLIBC_MINOR__ >= (2 << 16) + 25)
|
|
-# undef HAVE_READAHEAD
|
|
-# endif /* LINUX_MIPSN64 && glibc < 2.25 */
|
|
-# endif /* __GLIBC__ */
|
|
+# if GLIBC_PREREQ_LT(2, 25) && defined LINUX_MIPSN64
|
|
+# undef HAVE_READAHEAD
|
|
+# endif /* LINUX_MIPSN64 && glibc < 2.25 */
|
|
#endif /* HAVE_READAHEAD */
|
|
|
|
#ifdef HAVE_READAHEAD
|
|
--
|
|
2.1.4
|
|
|