summaryrefslogtreecommitdiff
path: root/internal/stdbool.h
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2019-12-25 13:40:10 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2019-12-26 20:45:12 +0900
commit8184adabe5018ff930fde64456029471c1ebcd2e (patch)
tree016a7cded62e4a7f0bb23a58c797ee77ce3c8378 /internal/stdbool.h
parent5e22f873ed26092522f9bfc617d729bac88b284f (diff)
internal/stdbool.h rework
Noticed that internal/stdbool.h and addr2line.c are the only two place where missing/stdbool.h is included. Why not delete the file so that we can merge internal/stdbool.h and missing/stdbool.h into one.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/2711
Diffstat (limited to 'internal/stdbool.h')
-rw-r--r--internal/stdbool.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/internal/stdbool.h b/internal/stdbool.h
index 4c103b43ce..e090e575e7 100644
--- a/internal/stdbool.h
+++ b/internal/stdbool.h
@@ -13,8 +13,22 @@
#ifdef HAVE_STDBOOL_H
# include <stdbool.h>
+#endif
+
+/* Note that we assume the compiler isn't C++. */
+#ifdef __bool_true_false_are_defined
+# undef bool
+# undef true
+# undef false
+# undef __bool_true_false_are_defined
#else
-# include "missing/stdbool.h"
+typedef unsigned char _Bool;
#endif
+/* See also http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2229.htm */
+#define bool _Bool
+#define true ((_Bool)+1)
+#define false ((_Bool)+0)
+#define __bool_true_false_are_defined
+
#endif /* INTERNAL_STDBOOL_H */