From 5a576028607c4bd7b46e8b1d2726329355d4bc03 Mon Sep 17 00:00:00 2001 From: dearblue Date: Sat, 21 Aug 2021 15:42:57 +0900 Subject: Organize the include of header files - `#include ` is done in `mruby.h`. Eliminate the need to worry about the `MRB_NO_FLOAT` macro. - Include mruby header files before standard header files. If the standard header file is already placed before `mruby.h`, the standard header file added in the future tends to be placed before `mruby.h`. This change should some reduce the chances of macros that must be defined becoming undefined in C++ or including problematic header files in a particular mruby build configuration. --- mrbgems/mruby-cmath/src/cmath.c | 1 - mrbgems/mruby-compiler/core/codegen.c | 5 ++--- mrbgems/mruby-complex/src/complex.c | 1 - mrbgems/mruby-math/src/math.c | 1 - mrbgems/mruby-numeric-ext/src/numeric_ext.c | 1 - mrbgems/mruby-range-ext/src/range.c | 1 - mrbgems/mruby-rational/src/rational.c | 1 - mrbgems/mruby-sprintf/src/sprintf.c | 5 +---- mrbgems/mruby-time/src/time.c | 4 ---- 9 files changed, 3 insertions(+), 17 deletions(-) (limited to 'mrbgems') diff --git a/mrbgems/mruby-cmath/src/cmath.c b/mrbgems/mruby-cmath/src/cmath.c index 03b181840..8b0c4d04a 100644 --- a/mrbgems/mruby-cmath/src/cmath.c +++ b/mrbgems/mruby-cmath/src/cmath.c @@ -15,7 +15,6 @@ # error CMath conflicts with 'MRB_NO_FLOAT' configuration #endif -#include #include mrb_value mrb_complex_new(mrb_state *mrb, mrb_float real, mrb_float imag); diff --git a/mrbgems/mruby-compiler/core/codegen.c b/mrbgems/mruby-compiler/core/codegen.c index 3f849b0f1..4546e6cc0 100644 --- a/mrbgems/mruby-compiler/core/codegen.c +++ b/mrbgems/mruby-compiler/core/codegen.c @@ -4,9 +4,6 @@ ** See Copyright Notice in mruby.h */ -#include -#include -#include #include #include #include @@ -19,6 +16,8 @@ #include #include #include +#include +#include #ifndef MRB_CODEGEN_LEVEL_MAX #define MRB_CODEGEN_LEVEL_MAX 1024 diff --git a/mrbgems/mruby-complex/src/complex.c b/mrbgems/mruby-complex/src/complex.c index 286e7e38e..66176c3c1 100644 --- a/mrbgems/mruby-complex/src/complex.c +++ b/mrbgems/mruby-complex/src/complex.c @@ -2,7 +2,6 @@ #include #include #include -#include #ifdef MRB_NO_FLOAT # error Complex conflicts with 'MRB_NO_FLOAT' configuration diff --git a/mrbgems/mruby-math/src/math.c b/mrbgems/mruby-math/src/math.c index 8eccc03e5..79fdb7c6f 100644 --- a/mrbgems/mruby-math/src/math.c +++ b/mrbgems/mruby-math/src/math.c @@ -12,7 +12,6 @@ #include #include -#include static void domain_error(mrb_state *mrb, const char *func) diff --git a/mrbgems/mruby-numeric-ext/src/numeric_ext.c b/mrbgems/mruby-numeric-ext/src/numeric_ext.c index 38d297374..2f2a6c755 100644 --- a/mrbgems/mruby-numeric-ext/src/numeric_ext.c +++ b/mrbgems/mruby-numeric-ext/src/numeric_ext.c @@ -1,7 +1,6 @@ #include #include #include -#include /* * call-seq: diff --git a/mrbgems/mruby-range-ext/src/range.c b/mrbgems/mruby-range-ext/src/range.c index 2d021f31f..633c97b73 100644 --- a/mrbgems/mruby-range-ext/src/range.c +++ b/mrbgems/mruby-range-ext/src/range.c @@ -1,6 +1,5 @@ #include #include -#include static mrb_bool r_le(mrb_state *mrb, mrb_value a, mrb_value b) diff --git a/mrbgems/mruby-rational/src/rational.c b/mrbgems/mruby-rational/src/rational.c index 7d099b1e2..dacce53eb 100644 --- a/mrbgems/mruby-rational/src/rational.c +++ b/mrbgems/mruby-rational/src/rational.c @@ -155,7 +155,6 @@ rational_new_i(mrb_state *mrb, mrb_int n, mrb_int d) } #ifndef MRB_NO_FLOAT -#include #if defined(MRB_INT32) || defined(MRB_USE_FLOAT32) #define frexp_rat(x,exp) frexpf((float)x, exp) diff --git a/mrbgems/mruby-sprintf/src/sprintf.c b/mrbgems/mruby-sprintf/src/sprintf.c index 362d24651..ba5ba4cda 100644 --- a/mrbgems/mruby-sprintf/src/sprintf.c +++ b/mrbgems/mruby-sprintf/src/sprintf.c @@ -5,14 +5,11 @@ */ #include -#include #include #include #include #include -#ifndef MRB_NO_FLOAT -#include -#endif +#include #include #define BIT_DIGITS(N) (((N)*146)/485 + 1) /* log2(10) =~ 146/485 */ diff --git a/mrbgems/mruby-time/src/time.c b/mrbgems/mruby-time/src/time.c index 99dcb2bcf..6b9762acf 100644 --- a/mrbgems/mruby-time/src/time.c +++ b/mrbgems/mruby-time/src/time.c @@ -4,10 +4,6 @@ ** See Copyright Notice in mruby.h */ -#ifndef MRB_NO_FLOAT -#include -#endif - #include #include #include -- cgit v1.2.3