[前][次][番号順一覧][スレッド一覧]

ruby-changes:64662

From: Kenta <ko1@a...>
Date: Tue, 29 Dec 2020 17:47:02 +0900 (JST)
Subject: [ruby-changes:64662] 47a1f5ff73 (master): [ruby/bigdecimal] Define bool, true, and false for old Ruby

https://git.ruby-lang.org/ruby.git/commit/?id=47a1f5ff73

From 47a1f5ff738c5f14f4ffd7def3536b61ce1f9ff0 Mon Sep 17 00:00:00 2001
From: Kenta Murata <mrkn@m...>
Date: Tue, 29 Dec 2020 17:14:36 +0900
Subject: [ruby/bigdecimal] Define bool, true, and false for old Ruby

https://github.com/ruby/bigdecimal/commit/a6d3bd2d44

diff --git a/ext/bigdecimal/bigdecimal.h b/ext/bigdecimal/bigdecimal.h
index 28f3363..c89f212 100644
--- a/ext/bigdecimal/bigdecimal.h
+++ b/ext/bigdecimal/bigdecimal.h
@@ -14,6 +14,20 @@ https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.h#L14
 #include "ruby/ruby.h"
 #include <float.h>
 
+#if defined(__bool_true_false_are_defined)
+# /* Take that. */
+
+#elif defined(HAVE_STDBOOL_H)
+# include <stdbool.h>
+
+#else
+typedef unsigned char _Bool;
+# define bool _Bool
+# define true  ((_Bool)+1)
+# define false ((_Bool)-1)
+# define __bool_true_false_are_defined
+#endif
+
 #ifndef RB_UNUSED_VAR
 # ifdef __GNUC__
 #  define RB_UNUSED_VAR(x) x __attribute__ ((unused))
diff --git a/ext/bigdecimal/extconf.rb b/ext/bigdecimal/extconf.rb
index 63123e2..41b8df8 100644
--- a/ext/bigdecimal/extconf.rb
+++ b/ext/bigdecimal/extconf.rb
@@ -28,6 +28,8 @@ end https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/extconf.rb#L28
 
 check_bigdecimal_version(gemspec_path)
 
+have_header("stdbool.h")
+
 have_func("labs", "stdlib.h")
 have_func("llabs", "stdlib.h")
 have_func("finite", "math.h")
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]