summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2019-12-04 17:16:30 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2019-12-26 20:45:12 +0900
commit5e22f873ed26092522f9bfc617d729bac88b284f (patch)
tree8d66856526cd7efa87b46c966298e6f42d67e68f /io.c
parent33e9601938a79dae149caa88ff1bc06d376dd376 (diff)
decouple internal.h headers
Saves comitters' daily life by avoid #include-ing everything from internal.h to make each file do so instead. This would significantly speed up incremental builds. We take the following inclusion order in this changeset: 1. "ruby/config.h", where _GNU_SOURCE is defined (must be the very first thing among everything). 2. RUBY_EXTCONF_H if any. 3. Standard C headers, sorted alphabetically. 4. Other system headers, maybe guarded by #ifdef 5. Everything else, sorted alphabetically. Exceptions are those win32-related headers, which tend not be self- containing (headers have inclusion order dependencies).
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/2711
Diffstat (limited to 'io.c')
-rw-r--r--io.c61
1 files changed, 39 insertions, 22 deletions
diff --git a/io.c b/io.c
index 42528c0fd5..37109f5def 100644
--- a/io.c
+++ b/io.c
@@ -11,38 +11,31 @@
**********************************************************************/
-#include "ruby/encoding.h"
-#include "ruby/io.h"
-#include "ruby/thread.h"
-#include "internal.h"
-#include "dln.h"
-#include "encindex.h"
-#include "id.h"
+#include "ruby/config.h"
+
+#ifdef _WIN32
+# include "ruby/ruby.h"
+# include "ruby/io.h"
+#endif
+
#include <ctype.h>
#include <errno.h>
-#include "ruby_atomic.h"
-#include "ccan/list/list.h"
+#include <stddef.h>
/* non-Linux poll may not work on all FDs */
#if defined(HAVE_POLL)
-# if defined(__linux__)
-# define USE_POLL 1
-# endif
-# if defined(__FreeBSD_version) && __FreeBSD_version >= 1100000
-# define USE_POLL 1
-# endif
+# if defined(__linux__)
+# define USE_POLL 1
+# endif
+# if defined(__FreeBSD_version) && __FreeBSD_version >= 1100000
+# define USE_POLL 1
+# endif
#endif
#ifndef USE_POLL
-# define USE_POLL 0
-#endif
-
-#if !USE_POLL
-# include "vm_core.h"
+# define USE_POLL 0
#endif
-#include "builtin.h"
-
#undef free
#define free(x) xfree(x)
@@ -119,7 +112,31 @@
# include <copyfile.h>
#endif
+#include "dln.h"
+#include "encindex.h"
+#include "id.h"
+#include "internal.h"
+#include "internal/encoding.h"
+#include "internal/error.h"
+#include "internal/inits.h"
+#include "internal/io.h"
+#include "internal/numeric.h"
+#include "internal/object.h"
+#include "internal/process.h"
+#include "internal/stdbool.h"
+#include "ccan/list/list.h"
+#include "internal/thread.h"
+#include "internal/transcode.h"
+#include "ruby/io.h"
+#include "ruby/thread.h"
#include "ruby/util.h"
+#include "ruby_atomic.h"
+
+#if !USE_POLL
+# include "vm_core.h"
+#endif
+
+#include "builtin.h"
#ifndef O_ACCMODE
#define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)