void-packages/srcpkgs/ecl/patches/fix-math_fenv_h.patch
Đoàn Trần Công Danh a03d116397 srcpkgs/e*: convert patches to -Np1
```sh

git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

99 lines
3 KiB
Diff

Source: @pullmoll
Upstream: no
Reason: Some architectures do not define all of the FE_.. constants
--- a/src/h/impl/math_fenv.h 2016-12-19 11:25:00.000000000 +0100
+++ b/src/h/impl/math_fenv.h 2020-04-25 15:36:04.984693324 +0200
@@ -67,8 +67,27 @@
#endif /* !HAVE_FENV_H */
#if defined(HAVE_FENV_H) && !defined(HAVE_FEENABLEEXCEPT) && !defined(ECL_AVOID_FPE_H)
-# define ECL_USED_EXCEPTIONS (FE_DIVBYZERO|FE_INVALID|FE_OVERFLOW|FE_UNDERFLOW)
-# define ECL_MATHERR_CLEAR feclearexcept(FE_ALL_EXCEPT)
+#if !defined(FE_DIVBYZERO)
+#define FE_DIVBYZERO 0
+#endif
+#if !defined(FE_INVALID)
+#define FE_INVALID 0
+#endif
+#if !defined(FE_OVERFLOW)
+#define FE_OVERFLOW 0
+#endif
+#if !defined(FE_UNDERFLOW)
+#define FE_UNDERFLOW 0
+#endif
+#if !defined(FE_INEXACT)
+#define FE_INEXACT 0
+#endif
+#if !defined(FE_ALL_EXCEPT)
+#define FE_ALL_EXCEPT 0
+#endif
+
+# define ECL_USED_EXCEPTIONS (FE_DIVBYZERO|FE_INVALID|FE_OVERFLOW|FE_UNDERFLOW)
+# define ECL_MATHERR_CLEAR feclearexcept(FE_ALL_EXCEPT)
# define ECL_MATHERR_TEST do { \
int bits = fetestexcept(ECL_USED_EXCEPTIONS); \
unlikely_if (bits) ecl_deliver_fpe(bits); } while(0)
--- a/src/c/unixint.d 2016-12-19 11:25:00.000000000 +0100
+++ b/src/c/unixint.d 2020-04-25 15:57:15.864783964 +0200
@@ -655,22 +655,36 @@
#else /* !_MSC_VER */
# if defined(HAVE_FENV_H) & !defined(ECL_AVOID_FENV_H)
code = fetestexcept(FE_ALL_EXCEPT);
+#if defined(FE_DIVBYZERO)
if (code & FE_DIVBYZERO) {
condition = @'division-by-zero';
code = FE_DIVBYZERO;
- } else if (code & FE_INVALID) {
+ } else
+#endif
+#if defined(FE_INVALID)
+ if (code & FE_INVALID) {
condition = @'floating-point-invalid-operation';
code = FE_INVALID;
- } else if (code & FE_OVERFLOW) {
+ } else
+#endif
+#if defined(FE_OVERFLOW)
+ if (code & FE_OVERFLOW) {
condition = @'floating-point-overflow';
code = FE_OVERFLOW;
- } else if (code & FE_UNDERFLOW) {
+ } else
+#endif
+#if defined(FE_UNDERFLOW)
+ if (code & FE_UNDERFLOW) {
condition = @'floating-point-underflow';
code = FE_UNDERFLOW;
- } else if (code & FE_INEXACT) {
+ } else
+#endif
+#if defined(FE_INEXACT)
+ if (code & FE_INEXACT) {
condition = @'floating-point-inexact';
code = FE_INEXACT;
}
+#endif
feclearexcept(FE_ALL_EXCEPT);
# endif
#endif /* !_MSC_VER */
@@ -1160,7 +1174,19 @@
{
cl_env_ptr the_env = ecl_process_env();
#ifndef FE_ALL_EXCEPT
+#if !defined(FE_DIVBYZERO)
+#define FE_DIVBYZERO 0
+#endif
+#if !defined(FE_OVERFLOW)
+#define FE_OVERFLOW 0
+#endif
+#if !defined(FE_UNDERFLOW)
+#define FE_UNDERFLOW 0
+#endif
+#if !defined(FE_INVALID)
+#define FE_INVALID 0
+#endif
# define FE_ALL_EXCEPT FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW | FE_INVALID
#endif
const int all = FE_ALL_EXCEPT;
int bits = 0;