diff options
author | 卜部昌平 <shyouhei@ruby-lang.org> | 2019-12-04 17:16:30 +0900 |
---|---|---|
committer | 卜部昌平 <shyouhei@ruby-lang.org> | 2019-12-26 20:45:12 +0900 |
commit | 5e22f873ed26092522f9bfc617d729bac88b284f (patch) | |
tree | 8d66856526cd7efa87b46c966298e6f42d67e68f /ext | |
parent | 33e9601938a79dae149caa88ff1bc06d376dd376 (diff) | |
download | ruby-5e22f873ed26092522f9bfc617d729bac88b284f.tar.gz |
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).
Diffstat (limited to 'ext')
-rw-r--r-- | ext/-test-/bignum/big2str.c | 2 | ||||
-rw-r--r-- | ext/-test-/bignum/bigzero.c | 2 | ||||
-rw-r--r-- | ext/-test-/bignum/div.c | 2 | ||||
-rw-r--r-- | ext/-test-/bignum/intpack.c | 2 | ||||
-rw-r--r-- | ext/-test-/bignum/mul.c | 2 | ||||
-rw-r--r-- | ext/-test-/bignum/str2big.c | 2 | ||||
-rw-r--r-- | ext/-test-/integer/core_ext.c | 2 | ||||
-rw-r--r-- | ext/-test-/rational/rat.c | 2 | ||||
-rw-r--r-- | ext/-test-/string/capacity.c | 2 | ||||
-rw-r--r-- | ext/-test-/string/cstr.c | 3 | ||||
-rw-r--r-- | ext/-test-/string/normalize.c | 2 | ||||
-rw-r--r-- | ext/-test-/time/leap_second.c | 3 | ||||
-rw-r--r-- | ext/coverage/coverage.c | 4 | ||||
-rw-r--r-- | ext/objspace/objspace.c | 12 | ||||
-rw-r--r-- | ext/objspace/objspace_dump.c | 10 | ||||
-rw-r--r-- | ext/pty/pty.c | 58 | ||||
-rw-r--r-- | ext/socket/rubysocket.h | 49 |
17 files changed, 99 insertions, 60 deletions
diff --git a/ext/-test-/bignum/big2str.c b/ext/-test-/bignum/big2str.c index ec4bde2915..bc5a933f82 100644 --- a/ext/-test-/bignum/big2str.c +++ b/ext/-test-/bignum/big2str.c @@ -1,4 +1,4 @@ -#include "internal.h" +#include "internal/bignum.h" static VALUE big(VALUE x) diff --git a/ext/-test-/bignum/bigzero.c b/ext/-test-/bignum/bigzero.c index 35117db7ae..e2bfebcd3e 100644 --- a/ext/-test-/bignum/bigzero.c +++ b/ext/-test-/bignum/bigzero.c @@ -1,4 +1,4 @@ -#include "internal.h" +#include "internal/bignum.h" static VALUE bug_big_zero(VALUE self, VALUE length) diff --git a/ext/-test-/bignum/div.c b/ext/-test-/bignum/div.c index a1db21dc30..2be0d2d62a 100644 --- a/ext/-test-/bignum/div.c +++ b/ext/-test-/bignum/div.c @@ -1,4 +1,4 @@ -#include "internal.h" +#include "internal/bignum.h" static VALUE big(VALUE x) diff --git a/ext/-test-/bignum/intpack.c b/ext/-test-/bignum/intpack.c index 2d19442cf2..698362f96f 100644 --- a/ext/-test-/bignum/intpack.c +++ b/ext/-test-/bignum/intpack.c @@ -1,4 +1,4 @@ -#include "internal.h" +#include "internal/bignum.h" static VALUE rb_integer_pack_raw_m(VALUE val, VALUE buf, VALUE numwords_arg, VALUE wordsize_arg, VALUE nails, VALUE flags) diff --git a/ext/-test-/bignum/mul.c b/ext/-test-/bignum/mul.c index b922f34437..1b6eb911bd 100644 --- a/ext/-test-/bignum/mul.c +++ b/ext/-test-/bignum/mul.c @@ -1,4 +1,4 @@ -#include "internal.h" +#include "internal/bignum.h" static VALUE big(VALUE x) diff --git a/ext/-test-/bignum/str2big.c b/ext/-test-/bignum/str2big.c index bc79ef0329..7dd2da9a07 100644 --- a/ext/-test-/bignum/str2big.c +++ b/ext/-test-/bignum/str2big.c @@ -1,4 +1,4 @@ -#include "internal.h" +#include "internal/bignum.h" static VALUE str2big_poweroftwo(VALUE str, VALUE vbase, VALUE badcheck) diff --git a/ext/-test-/integer/core_ext.c b/ext/-test-/integer/core_ext.c index 510ba4a1e6..2062fa3afa 100644 --- a/ext/-test-/integer/core_ext.c +++ b/ext/-test-/integer/core_ext.c @@ -1,4 +1,4 @@ -#include "internal.h" +#include "internal/numeric.h" static VALUE int_bignum_p(VALUE self) diff --git a/ext/-test-/rational/rat.c b/ext/-test-/rational/rat.c index 772546fca8..01388346f7 100644 --- a/ext/-test-/rational/rat.c +++ b/ext/-test-/rational/rat.c @@ -1,4 +1,4 @@ -#include "internal.h" +#include "internal/rational.h" #if defined(HAVE_LIBGMP) && defined(HAVE_GMP_H) static VALUE diff --git a/ext/-test-/string/capacity.c b/ext/-test-/string/capacity.c index f5277bf4e6..cb8d2c2b3a 100644 --- a/ext/-test-/string/capacity.c +++ b/ext/-test-/string/capacity.c @@ -1,5 +1,5 @@ #include "ruby.h" -#include "internal.h" +#include "internal/string.h" static VALUE bug_str_capacity(VALUE klass, VALUE str) diff --git a/ext/-test-/string/cstr.c b/ext/-test-/string/cstr.c index 71eafdb703..5a464451da 100644 --- a/ext/-test-/string/cstr.c +++ b/ext/-test-/string/cstr.c @@ -1,5 +1,6 @@ -#include "ruby/encoding.h" #include "internal.h" +#include "internal/error.h" +#include "ruby/encoding.h" static VALUE bug_str_cstr_term(VALUE str) diff --git a/ext/-test-/string/normalize.c b/ext/-test-/string/normalize.c index 0ba1797631..a069288ee8 100644 --- a/ext/-test-/string/normalize.c +++ b/ext/-test-/string/normalize.c @@ -1,4 +1,4 @@ -#include "internal.h" +#include "internal/file.h" #ifdef __APPLE__ static VALUE diff --git a/ext/-test-/time/leap_second.c b/ext/-test-/time/leap_second.c index 7eed421b73..ccf38194f0 100644 --- a/ext/-test-/time/leap_second.c +++ b/ext/-test-/time/leap_second.c @@ -1,6 +1,5 @@ -#include "ruby.h" +#include "internal/time.h" -void ruby_reset_leap_second_info(void); static VALUE bug_time_s_reset_leap_second_info(VALUE klass) { diff --git a/ext/coverage/coverage.c b/ext/coverage/coverage.c index 8503c9d6c6..34b0849fc4 100644 --- a/ext/coverage/coverage.c +++ b/ext/coverage/coverage.c @@ -8,9 +8,11 @@ ************************************************/ +#include "gc.h" +#include "internal/hash.h" +#include "internal/thread.h" #include "ruby.h" #include "vm_core.h" -#include "gc.h" static int current_mode; static VALUE me2counter = Qnil; diff --git a/ext/objspace/objspace.c b/ext/objspace/objspace.c index 311e687206..6d5f6c073a 100644 --- a/ext/objspace/objspace.c +++ b/ext/objspace/objspace.c @@ -12,12 +12,16 @@ **********************************************************************/ -#include <ruby/io.h> +#include "gc.h" #include "internal.h" -#include <ruby/st.h> -#include <ruby/re.h> +#include "internal/class.h" +#include "internal/compilers.h" +#include "internal/hash.h" +#include "internal/imemo.h" #include "node.h" -#include "gc.h" +#include "ruby/io.h" +#include "ruby/re.h" +#include "ruby/st.h" #include "symbol.h" /* diff --git a/ext/objspace/objspace_dump.c b/ext/objspace/objspace_dump.c index 5fa9d98e38..d753b48a80 100644 --- a/ext/objspace/objspace_dump.c +++ b/ext/objspace/objspace_dump.c @@ -12,13 +12,15 @@ **********************************************************************/ -#include "ruby/io.h" -#include "internal.h" -#include "ruby/debug.h" #include "gc.h" +#include "internal.h" +#include "internal/hash.h" +#include "internal/string.h" #include "node.h" -#include "vm_core.h" #include "objspace.h" +#include "ruby/debug.h" +#include "ruby/io.h" +#include "vm_core.h" static VALUE sym_output, sym_stdout, sym_string, sym_file; static VALUE sym_full; diff --git a/ext/pty/pty.c b/ext/pty/pty.c index 4c6ae26127..485f61c304 100644 --- a/ext/pty/pty.c +++ b/ext/pty/pty.c @@ -1,45 +1,51 @@ -#include "ruby/config.h" +#include "ruby/config.h" + #ifdef RUBY_EXTCONF_H -#include RUBY_EXTCONF_H +# include RUBY_EXTCONF_H #endif -#include <stdlib.h> -#include <stdio.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <sys/file.h> -#include <fcntl.h> -#include <errno.h> + +#include <ctype.h> +#include <errno.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> + +#include <sys/types.h> +#include <sys/stat.h> +#include <sys/file.h> +#include <fcntl.h> + #ifdef HAVE_PWD_H -#include <pwd.h> +# include <pwd.h> #endif + #ifdef HAVE_SYS_IOCTL_H -#include <sys/ioctl.h> +# include <sys/ioctl.h> #endif + #ifdef HAVE_LIBUTIL_H -#include <libutil.h> +# include <libutil.h> #endif + #ifdef HAVE_UTIL_H -#include <util.h> +# include <util.h> #endif + #ifdef HAVE_PTY_H -#include <pty.h> +# include <pty.h> #endif + #if defined(HAVE_SYS_PARAM_H) - /* for __FreeBSD_version */ + /* for __FreeBSD_version */ # include <sys/param.h> #endif + #ifdef HAVE_SYS_WAIT_H -#include <sys/wait.h> +# include <sys/wait.h> #else -#define WIFSTOPPED(status) (((status) & 0xff) == 0x7f) +# define WIFSTOPPED(status) (((status) & 0xff) == 0x7f) #endif -#include <ctype.h> - -#include "ruby/io.h" -#include "internal.h" -#include "ruby/util.h" -#include <signal.h> #ifdef HAVE_SYS_STROPTS_H #include <sys/stropts.h> #endif @@ -48,6 +54,12 @@ #include <unistd.h> #endif +#include "internal.h" +#include "internal/process.h" +#include "internal/signal.h" +#include "ruby/io.h" +#include "ruby/util.h" + #define DEVICELEN 16 #ifndef HAVE_SETEUID diff --git a/ext/socket/rubysocket.h b/ext/socket/rubysocket.h index 0ce77a5f6e..5dca68a198 100644 --- a/ext/socket/rubysocket.h +++ b/ext/socket/rubysocket.h @@ -1,12 +1,12 @@ #ifndef RUBY_SOCKET_H #define RUBY_SOCKET_H 1 -#include "ruby/ruby.h" -#include "ruby/io.h" -#include "ruby/thread.h" -#include "ruby/util.h" -#include "internal.h" +#include "ruby/config.h" +#include RUBY_EXTCONF_H + +#include <errno.h> #include <stdio.h> + #include <sys/types.h> #include <sys/stat.h> @@ -56,12 +56,11 @@ #ifdef HAVE_NETPACKET_PACKET_H # include <netpacket/packet.h> #endif + #ifdef HAVE_NET_ETHERNET_H # include <net/ethernet.h> #endif -#include <errno.h> - #ifdef HAVE_SYS_UN_H # include <sys/un.h> #endif @@ -87,12 +86,15 @@ # endif # include <ifaddrs.h> #endif + #ifdef HAVE_SYS_IOCTL_H # include <sys/ioctl.h> #endif + #ifdef HAVE_SYS_SOCKIO_H # include <sys/sockio.h> #endif + #ifdef HAVE_NET_IF_H # include <net/if.h> #endif @@ -100,16 +102,40 @@ #ifdef HAVE_SYS_PARAM_H # include <sys/param.h> #endif + #ifdef HAVE_SYS_UCRED_H # include <sys/ucred.h> #endif + #ifdef HAVE_UCRED_H # include <ucred.h> #endif + #ifdef HAVE_NET_IF_DL_H # include <net/if_dl.h> #endif +#ifdef SOCKS5 +# include <socks.h> +#endif + +#ifndef HAVE_GETADDRINFO +# include "addrinfo.h" +#endif + +#include "internal.h" +#include "internal/array.h" +#include "internal/error.h" +#include "internal/gc.h" +#include "internal/io.h" +#include "internal/thread.h" +#include "internal/vm.h" +#include "ruby/io.h" +#include "ruby/ruby.h" +#include "ruby/thread.h" +#include "ruby/util.h" +#include "sockport.h" + #ifndef HAVE_TYPE_SOCKLEN_T typedef int socklen_t; #endif @@ -143,11 +169,6 @@ unsigned int if_nametoindex(const char *); */ #define pseudo_AF_FTIP pseudo_AF_RTIP -#ifndef HAVE_GETADDRINFO -# include "addrinfo.h" -#endif - -#include "sockport.h" #ifndef NI_MAXHOST # define NI_MAXHOST 1025 @@ -255,9 +276,7 @@ extern VALUE rb_eSocket; #ifdef SOCKS extern VALUE rb_cSOCKSSocket; -# ifdef SOCKS5 -# include <socks.h> -# else +# ifndef SOCKS5 void SOCKSinit(); int Rconnect(); # endif |