aboutsummaryrefslogtreecommitdiffstats
path: root/internal.h
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-01-30 04:42:04 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-01-30 04:42:04 +0000
commitdd039cb8623297304fd3e7543dfcd1576c05c6c8 (patch)
tree91332dc750f19c29e13bb3ecf627c0c411c12c7d /internal.h
parentc190227b4393e34acbb7d0bedb71b09804bfab8a (diff)
downloadruby-dd039cb8623297304fd3e7543dfcd1576c05c6c8.tar.gz
#include <stdbool.h>
17+ years passed since standardized in ISO, 8 years since we added AC_HEADER_STDBOOL to configure.in. I'm quite confident that it's already safe to use <stdbool.h>. I understand that when we introduced AC_HEADER_STDBOOL, <stdbool.h> was remain not included because C standard and SVR4 curses conflicted miserably back then (#1). Though I believe such situation has been fixed already(#2), I'm afraid of your operating system might ship a proprietary curses that still conflicts with the standard. So to avoid potential problem, we limit the inclusion to our internal use only. #1 : 1997 version of SUSv2 said bool is "defined though typedef" in <curses.h>, while C99 said bool is a macro, plus in C++ bool is a keyword. AFASIK the curses library has never been a part of POSIX. #2 : In reality ncurses and NetBSD curses both just follow C99 to include <stdbool.h> from <curses.h>. I think C99 is now widely adopted. ---- * internal.h: #include <stdbool.h> if present. That is believed to be the case for 99.9% systems that lives today. Non-C99, non-C++ situations are intentionally left undefined, advised by Motohiro Kosaki. If you have such compiler, please fill the definition appropriately. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57460 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'internal.h')
-rw-r--r--internal.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/internal.h b/internal.h
index ce4cc3c996..f57b6f9c81 100644
--- a/internal.h
+++ b/internal.h
@@ -23,6 +23,19 @@ extern "C" {
#endif
#endif
+#ifdef HAVE_STDBOOL_H
+# include <stdbool.h>
+#endif
+
+#ifndef __bool_true_false_are_defined
+# ifndef __cplusplus
+# error :FIXME: You are the first one who use pre-C99 compiler.
+# error :FIXME: Please add appropriate definition here.
+# error :FIXME: This part is intentionally left undefined,
+# error :FIXME: because the author no longer have such environment.
+# endif
+#endif
+
#define LIKELY(x) RB_LIKELY(x)
#define UNLIKELY(x) RB_UNLIKELY(x)