diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2019-07-22 20:19:01 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2019-07-22 20:19:01 +0900 |
| commit | 949f6f53248c1679bb14229777a064c0fe383b6a (patch) | |
| tree | b7460906b62301793da5f5b60f1c94592a726ae9 /mrbgems/mruby-complex/src | |
| parent | f99e9963b2145812b6f2bd7f0dd3d8228c503c82 (diff) | |
| download | mruby-949f6f53248c1679bb14229777a064c0fe383b6a.tar.gz mruby-949f6f53248c1679bb14229777a064c0fe383b6a.zip | |
Check conflicts with `Complex` and `MRB_WITHOUT_FLOAT`; ref #4576
The Complex class needs `mrb_float` so that it does not work with
`MRB_WITHOUT_FLOAT` anyway.
Diffstat (limited to 'mrbgems/mruby-complex/src')
| -rw-r--r-- | mrbgems/mruby-complex/src/complex.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/mrbgems/mruby-complex/src/complex.c b/mrbgems/mruby-complex/src/complex.c index 8a0569d68..d6414a5e1 100644 --- a/mrbgems/mruby-complex/src/complex.c +++ b/mrbgems/mruby-complex/src/complex.c @@ -2,6 +2,10 @@ #include <mruby/class.h> #include <mruby/numeric.h> +#ifdef MRB_WITHOUT_FLOAT +# error Complex conflicts 'MRB_WITHOUT_FLOAT' configuration in your 'build_config.rb' +#endif + struct mrb_complex { mrb_float real; mrb_float imaginary; @@ -91,7 +95,6 @@ complex_s_rect(mrb_state *mrb, mrb_value self) return complex_new(mrb, real, imaginary); } -#ifndef MRB_WITHOUT_FLOAT static mrb_value complex_to_f(mrb_state *mrb, mrb_value self) { @@ -103,7 +106,6 @@ complex_to_f(mrb_state *mrb, mrb_value self) return mrb_float_value(mrb, p->real); } -#endif static mrb_value complex_to_i(mrb_state *mrb, mrb_value self) @@ -137,9 +139,7 @@ void mrb_mruby_complex_gem_init(mrb_state *mrb) mrb_define_method(mrb, mrb->kernel_module, "Complex", complex_s_rect, MRB_ARGS_REQ(1)|MRB_ARGS_OPT(1)); mrb_define_method(mrb, comp, "real", complex_real, MRB_ARGS_NONE()); mrb_define_method(mrb, comp, "imaginary", complex_imaginary, MRB_ARGS_NONE()); -#ifndef MRB_WITHOUT_FLOAT mrb_define_method(mrb, comp, "to_f", complex_to_f, MRB_ARGS_NONE()); -#endif mrb_define_method(mrb, comp, "to_i", complex_to_i, MRB_ARGS_NONE()); mrb_define_method(mrb, comp, "to_c", complex_to_c, MRB_ARGS_NONE()); } |
