bison: fix build with ndk-r23
This commit is contained in:
parent
d98c0a9fe5
commit
ba4be062e6
@ -3,6 +3,7 @@ TERMUX_PKG_DESCRIPTION="General-purpose parser generator"
|
||||
TERMUX_PKG_LICENSE="GPL-3.0"
|
||||
TERMUX_PKG_MAINTAINER="@termux"
|
||||
TERMUX_PKG_VERSION=3.8.2
|
||||
TERMUX_PKG_REVISION=1
|
||||
TERMUX_PKG_SRCURL=https://mirrors.kernel.org/gnu/bison/bison-${TERMUX_PKG_VERSION}.tar.xz
|
||||
TERMUX_PKG_SHA256=9bba0214ccf7f1079c5d59210045227bcf619519840ebfa80cd3849cff5a5bf2
|
||||
TERMUX_PKG_DEPENDS="m4"
|
||||
|
50
packages/bison/ffsl.h.patch
Normal file
50
packages/bison/ffsl.h.patch
Normal file
@ -0,0 +1,50 @@
|
||||
--- ../ffsl.h.orig 2021-11-09 21:28:29.347410128 +0100
|
||||
+++ ./lib/ffsl.h 2021-11-09 21:28:50.760733519 +0100
|
||||
@@ -46,47 +46,3 @@
|
||||
#if !defined FUNC || !defined TYPE
|
||||
# error
|
||||
#endif
|
||||
-
|
||||
-int
|
||||
-FUNC (TYPE i)
|
||||
-{
|
||||
-#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) \
|
||||
- || (__clang_major__ >= 4)
|
||||
- return GCC_BUILTIN (i);
|
||||
-#elif defined _MSC_VER && defined MSVC_BUILTIN
|
||||
- /* _BitScanForward, _BitScanForward64
|
||||
- <https://docs.microsoft.com/en-us/cpp/intrinsics/bitscanforward-bitscanforward64> */
|
||||
- unsigned long bit;
|
||||
- if (MSVC_BUILTIN (&bit, i))
|
||||
- return bit + 1;
|
||||
- else
|
||||
- return 0;
|
||||
-#else
|
||||
- unsigned TYPE j = i;
|
||||
- /* Split j into chunks, and look at one chunk after the other. */
|
||||
- enum { chunk_bits = CHAR_BIT * sizeof (unsigned int) };
|
||||
- /* The number of chunks is ceil (sizeof (TYPE) / sizeof (unsigned int))
|
||||
- = (sizeof (TYPE) - 1) / sizeof (unsigned int) + 1. */
|
||||
- enum { chunk_count = (sizeof (TYPE) - 1) / sizeof (unsigned int) + 1 };
|
||||
-
|
||||
- if (chunk_count > 1)
|
||||
- {
|
||||
- size_t k;
|
||||
-
|
||||
- /* It is tempting to write if (!j) here, but if we do this,
|
||||
- Solaris 10/x86 "cc -O" miscompiles the code. */
|
||||
- if (!i)
|
||||
- return 0;
|
||||
- /* Unroll the first loop round. k = 0. */
|
||||
- if ((unsigned int) j)
|
||||
- return ffs ((unsigned int) j);
|
||||
- /* Generic loop. */
|
||||
- for (k = 1; k < chunk_count - 1; k++)
|
||||
- if ((unsigned int) (j >> (k * chunk_bits)) != 0)
|
||||
- return k * chunk_bits + ffs ((unsigned int) (j >> (k * chunk_bits)));
|
||||
- }
|
||||
- /* Last loop round. k = chunk_count - 1. */
|
||||
- return (chunk_count - 1) * chunk_bits
|
||||
- + ffs ((unsigned int) (j >> ((chunk_count - 1) * chunk_bits)));
|
||||
-#endif
|
||||
-}
|
Loading…
x
Reference in New Issue
Block a user