Skip to content

Commit 4782fc5

Browse files
authored
Fix error compiling with ruby.wasm (#504)
Add a workaround for compile failure when rb_complex_real exists but HAVE_RB_COMPLEX_REAL is somehow undefined.
1 parent 39853fa commit 4782fc5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ext/bigdecimal/missing.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,26 +58,28 @@ char *BigDecimal_dtoa(double d_, int mode, int ndigits, int *decpt, int *sign, c
5858

5959
#ifndef HAVE_RB_COMPLEX_REAL
6060
static inline VALUE
61-
rb_complex_real(VALUE cmp)
61+
rb_complex_real_fallback(VALUE cmp)
6262
{
6363
#ifdef RCOMPLEX
6464
return RCOMPLEX(cmp)->real;
6565
#else
6666
return rb_funcall(cmp, rb_intern("real"), 0);
6767
#endif
6868
}
69+
#define rb_complex_real rb_complex_real_fallback
6970
#endif
7071

7172
#ifndef HAVE_RB_COMPLEX_IMAG
7273
static inline VALUE
73-
rb_complex_imag(VALUE cmp)
74+
rb_complex_imag_fallback(VALUE cmp)
7475
{
7576
# ifdef RCOMPLEX
7677
return RCOMPLEX(cmp)->imag;
7778
# else
7879
return rb_funcall(cmp, rb_intern("imag"), 0);
7980
# endif
8081
}
82+
#define rb_complex_imag rb_complex_imag_fallback
8183
#endif
8284

8385
/* st */

0 commit comments

Comments
 (0)