ruby-changes:59503
From: =E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3 <ko1@a...>
Date: Fri, 27 Dec 2019 02:43:41 +0900 (JST)
Subject: [ruby-changes:59503] 5e22f873ed (master): decouple internal.h headers
https://git.ruby-lang.org/ruby.git/commit/?id=5e22f873ed From 5e22f873ed26092522f9bfc617d729bac88b284f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?= <shyouhei@r...> Date: Wed, 4 Dec 2019 17:16:30 +0900 Subject: 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). diff --git a/array.c b/array.c index 28bd8c8..9846320 100644 --- a/array.c +++ b/array.c @@ -10,14 +10,25 @@ https://github.com/ruby/ruby/blob/trunk/array.c#L10 Copyright (C) 2000 Information-technology Promotion Agency, Japan **********************************************************************/ + +#include "debug_counter.h" +#include "id.h" +#include "internal.h" +#include "internal/array.h" +#include "internal/compar.h" +#include "internal/enum.h" +#include "internal/gc.h" +#include "internal/hash.h" +#include "internal/numeric.h" +#include "internal/object.h" +#include "internal/proc.h" +#include "internal/rational.h" +#include "internal/vm.h" +#include "probes.h" #include "ruby/encoding.h" -#include "ruby/util.h" #include "ruby/st.h" -#include "probes.h" -#include "id.h" -#include "debug_counter.h" +#include "ruby/util.h" #include "transient_heap.h" -#include "internal.h" #if !ARRAY_DEBUG # define NDEBUG diff --git a/ast.c b/ast.c index 1133fb8..3f7061a 100644 --- a/ast.c +++ b/ast.c @@ -1,11 +1,15 @@ https://github.com/ruby/ruby/blob/trunk/ast.c#L1 /* indent-tabs-mode: nil */ +#include "internal.h" +#include "internal/parse.h" +#include "internal/symbol.h" +#include "internal/warnings.h" +#include "iseq.h" +#include "node.h" #include "ruby.h" #include "ruby/encoding.h" #include "ruby/util.h" -#include "internal.h" -#include "node.h" #include "vm_core.h" -#include "iseq.h" + #include "builtin.h" static VALUE rb_mAST; diff --git a/bignum.c b/bignum.c index 3923da7..8492853 100644 --- a/bignum.c +++ b/bignum.c @@ -9,27 +9,40 @@ https://github.com/ruby/ruby/blob/trunk/bignum.c#L9 **********************************************************************/ -#include "internal.h" -#include "ruby/thread.h" -#include "ruby/util.h" -#include "id.h" +#include "ruby/config.h" + +#include <ctype.h> +#include <float.h> +#include <math.h> #ifdef HAVE_STRINGS_H -#include <strings.h> +# include <strings.h> #endif -#include <math.h> -#include <float.h> -#include <ctype.h> + #ifdef HAVE_IEEEFP_H -#include <ieeefp.h> +# include <ieeefp.h> #endif -#include "ruby_assert.h" #if defined(HAVE_LIBGMP) && defined(HAVE_GMP_H) -#define USE_GMP -#include <gmp.h> +# define USE_GMP +# include <gmp.h> #endif +#include "id.h" +#include "internal.h" +#include "internal/bignum.h" +#include "internal/complex.h" +#include "internal/gc.h" +#include "internal/numeric.h" +#include "internal/object.h" +#include "internal/sanitizers.h" +#include "internal/util.h" +#include "internal/variable.h" +#include "internal/warnings.h" +#include "ruby/thread.h" +#include "ruby/util.h" +#include "ruby_assert.h" + #define RB_BIGNUM_TYPE_P(x) RB_TYPE_P((x), T_BIGNUM) #ifndef RUBY_INTEGER_UNIFICATION diff --git a/class.c b/class.c index c866d1d..bc64ff7 100644 --- a/class.c +++ b/class.c @@ -23,12 +23,20 @@ https://github.com/ruby/ruby/blob/trunk/class.c#L23 * \{ */ +#include "ruby/config.h" +#include <ctype.h> + +#include "constant.h" +#include "id_table.h" #include "internal.h" +#include "internal/class.h" +#include "internal/error.h" +#include "internal/eval.h" +#include "internal/hash.h" +#include "internal/object.h" +#include "internal/variable.h" #include "ruby/st.h" -#include "constant.h" #include "vm_core.h" -#include "id_table.h" -#include <ctype.h> #define id_attached id__attached__ diff --git a/compar.c b/compar.c index 94072c9..15ebfcd 100644 --- a/compar.c +++ b/compar.c @@ -9,9 +9,12 @@ https://github.com/ruby/ruby/blob/trunk/compar.c#L9 **********************************************************************/ -#include "ruby/ruby.h" #include "id.h" #include "internal.h" +#include "internal/compar.h" +#include "internal/error.h" +#include "internal/vm.h" +#include "ruby/ruby.h" VALUE rb_mComparable; diff --git a/compile.c b/compile.c index 7043ba9..200670f 100644 --- a/compile.c +++ b/compile.c @@ -9,25 +9,39 @@ https://github.com/ruby/ruby/blob/trunk/compile.c#L9 **********************************************************************/ -#include "ruby/encoding.h" -#include "ruby/re.h" -#include "ruby/util.h" -#include "internal.h" -#include "encindex.h" +#include "ruby/config.h" #include <math.h> +#ifdef HAVE_DLADDR +# include <dlfcn.h> +#endif + +#include "encindex.h" +#include "gc.h" +#include "id_table.h" +#include "internal.h" +#include "internal/array.h" +#include "internal/compile.h" +#include "internal/complex.h" +#include "internal/debug.h" +#include "internal/encoding.h" +#include "internal/error.h" +#include "internal/hash.h" +#include "internal/numeric.h" +#include "internal/object.h" +#include "internal/re.h" +#include "internal/symbol.h" +#include "internal/thread.h" +#include "internal/variable.h" +#include "iseq.h" +#include "ruby/re.h" +#include "ruby/util.h" #include "vm_core.h" #include "vm_debug.h" + #include "builtin.h" -#include "iseq.h" #include "insns.inc" #include "insns_info.inc" -#include "id_table.h" -#include "gc.h" - -#ifdef HAVE_DLADDR -# include <dlfcn.h> -#endif #undef RUBY_UNTYPED_DATA_WARNING #define RUBY_UNTYPED_DATA_WARNING 0 diff --git a/complex.c b/complex.c index cdd5edc..bce22be 100644 --- a/complex.c +++ b/complex.c @@ -6,15 +6,25 @@ https://github.com/ruby/ruby/blob/trunk/complex.c#L6 */ #include "ruby/config.h" + #if defined _MSC_VER /* Microsoft Visual C does not define M_PI and others by default */ # define _USE_MATH_DEFINES 1 #endif + +#include <ctype.h> #include <math.h> -#include "internal.h" -#include "id.h" #define NDEBUG +#include "id.h" +#include "internal.h" +#include "internal/class.h" +#include "internal/complex.h" +#include "internal/error.h" +#include "internal/math.h" +#include "internal/numeric.h" +#include "internal/object.h" +#include "internal/rational.h" #include "ruby_assert.h" #define ZERO INT2FIX(0) @@ -1700,8 +1710,6 @@ numeric_to_c(VALUE self) https://github.com/ruby/ruby/blob/trunk/complex.c#L1710 return rb_complex_new1(self); } -#include <ctype.h> - inline static int issign(int c) { diff --git a/constant.h b/constant.h index 610bdf1..1396651 100644 --- a/constant.h +++ b/constant.h @@ -10,6 +10,8 @@ https://github.com/ruby/ruby/blob/trunk/constant.h#L10 **********************************************************************/ #ifndef CONSTANT_H #define CONSTANT_H +#include "ruby/ruby.h" +#include "id_table.h" typedef enum { CONST_DEPRECATED = 0x100, diff --git a/cont.c b/cont.c index 793bce0..2365406 100644 --- a/cont.c +++ b/cont.c @@ -9,19 +9,25 @@ https://github.com/ruby/ruby/blob/trunk/cont.c#L9 **********************************************************************/ -#include "internal.h" -#include "vm_core.h" -#include "gc.h" -#include "eval_intern.h" -#include "mjit.h" - -#include COROUTINE_H +#include "ruby/config.h" #ifndef _WIN32 #include <unistd.h> #include <sys/mman.h> #endif +#include COROUTINE_H + +#include "eval_intern.h" +#include "gc.h" +#include "internal.h" +#include "internal/cont.h" +#include "internal/mjit.h" +#include "internal/proc.h" +#include "internal/warnings.h" +#include "mjit.h" +#include "vm_core.h" + static const int DEBUG = 0; #define RB_PAGE_SIZE (pagesize) diff --git a/coroutine/amd64/Context.h b/coroutine/amd64/Context.h index 8fe323c..441c449 100644 --- a/coroutine/amd64/Context.h +++ b/coroutine/amd64/Context.h @@ -8,6 +8,8 @@ https://github.com/ruby/ruby/blob/trunk/coroutine/amd64/Context.h#L8 #pragma once #include <assert.h> +#include <stddef.h> +#include <stdint.h> #include <string.h> #define COROUTINE __attribute__((noreturn)) void diff --git a/coroutine/arm32/Context.h b/coroutine/arm32/Context.h index e29fe1b..8bba8f6 100644 --- a/coroutine/arm32/Context.h +++ b/coroutine/arm32/Context.h @@ -8,6 +8,8 @@ https://github.com/ruby/ruby/blob/trunk/coroutine/arm32/Context.h#L8 #pragma once #include <assert.h> +#include <stddef.h> +#include <stdint.h> #include <string.h> #define COROUTINE __attribute__((noreturn)) void diff --git a/coroutine/arm64/Context.h b/coroutine/arm64/Context.h index a1ae921..63170ce 100644 --- a/coroutine/arm64/Context.h +++ b/coroutine/arm64/Context.h @@ -8,6 +8,8 @@ https://github.com/ruby/ruby/blob/trunk/coroutine/arm64/Context.h#L8 #pragma once #include <assert.h> +#include <stddef.h> +#include <stdint.h> #include <string.h> #define COROUTINE __attribute__((noreturn)) void diff --git a/coroutine/ppc64le/Context.h b/coroutine/ppc64le/Context.h index adf21b4..e36f9c3 100644 --- a/coroutine/ppc64le/Context.h +++ b/coroutine/ppc64le/Context.h @@ -1,6 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/coroutine/ppc64le/Context.h#L1 #pragma once #include <assert.h> +#include <stddef.h> +#include <stdint.h> #include <string.h> #define COROUTINE __attribute__((noreturn)) void diff --git a/coroutine/win32/Context.h b/coroutine/win32/Context.h index 299515e..68a71a7 100644 --- a/coroutine/win32/Context.h +++ b/coroutine/win32/Context.h @@ -8,6 +8,8 @@ https://github.com/ruby/ruby/blob/trunk/coroutine/win32/Context.h#L8 #pragma once #include <assert.h> +#include <stddef.h> +#include <stdint.h> #include <string.h> #define COR (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/