summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2021-07-24 19:03:32 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2021-07-25 13:07:10 +0900
commit5c804cf68f2b7e80780d3d812efb70ef9e376c08 (patch)
treea2a135237c605849eda427e267e71770a09df330
parent1f90a397994376451e1efd2055c25a240832d5a1 (diff)
downloadmruby-5c804cf68f2b7e80780d3d812efb70ef9e376c08.tar.gz
mruby-5c804cf68f2b7e80780d3d812efb70ef9e376c08.zip
Remove redundant include headers.
- stdlib.h - stddef.h - stdint.h - stdarg.h - limits.h - float.h
-rw-r--r--include/mrbconf.h3
-rw-r--r--include/mruby/numeric.h2
-rw-r--r--include/mruby/value.h2
-rw-r--r--mrbgems/mruby-bin-debugger/tools/mrdb/apilist.c1
-rw-r--r--mrbgems/mruby-compiler/core/codegen.c1
-rw-r--r--mrbgems/mruby-io/src/file.c1
-rw-r--r--mrbgems/mruby-math/src/math.c2
-rw-r--r--mrbgems/mruby-numeric-ext/src/numeric_ext.c1
-rw-r--r--mrbgems/mruby-print/src/print.c1
-rw-r--r--mrbgems/mruby-random/src/random.c2
-rw-r--r--mrbgems/mruby-socket/src/socket.c1
-rw-r--r--mrbgems/mruby-sprintf/src/sprintf.c1
-rw-r--r--mrbgems/mruby-time/src/time.c1
-rw-r--r--src/class.c1
-rw-r--r--src/dump.c1
-rw-r--r--src/error.c1
-rw-r--r--src/fmt_fp.c1
-rw-r--r--src/gc.c5
-rw-r--r--src/load.c2
-rw-r--r--src/numeric.c3
-rw-r--r--src/readflt.c1
-rw-r--r--src/string.c12
-rw-r--r--src/symbol.c1
-rw-r--r--src/vm.c8
24 files changed, 12 insertions, 43 deletions
diff --git a/include/mrbconf.h b/include/mrbconf.h
index 2a320f371..5d54a1c22 100644
--- a/include/mrbconf.h
+++ b/include/mrbconf.h
@@ -7,9 +7,6 @@
#ifndef MRUBYCONF_H
#define MRUBYCONF_H
-#include <limits.h>
-#include <stdint.h>
-
/* architecture selection: */
/* specify -DMRB_32BIT or -DMRB_64BIT to override */
#if !defined(MRB_32BIT) && !defined(MRB_64BIT)
diff --git a/include/mruby/numeric.h b/include/mruby/numeric.h
index e09a797ed..4b14588ac 100644
--- a/include/mruby/numeric.h
+++ b/include/mruby/numeric.h
@@ -133,8 +133,6 @@ mrb_int_mul_overflow(mrb_int a, mrb_int b, mrb_int *c)
#endif
#ifndef MRB_NO_FLOAT
-# include <stdint.h>
-# include <float.h>
# define MRB_FLT_RADIX FLT_RADIX
diff --git a/include/mruby/value.h b/include/mruby/value.h
index d65da30fb..35d4b7005 100644
--- a/include/mruby/value.h
+++ b/include/mruby/value.h
@@ -111,13 +111,11 @@ MRB_API double mrb_float_read(const char*, char**);
#endif
#if defined _MSC_VER && _MSC_VER < 1900
-# include <stdarg.h>
MRB_API int mrb_msvc_vsnprintf(char *s, size_t n, const char *format, va_list arg);
MRB_API int mrb_msvc_snprintf(char *s, size_t n, const char *format, ...);
# define vsnprintf(s, n, format, arg) mrb_msvc_vsnprintf(s, n, format, arg)
# define snprintf(s, n, format, ...) mrb_msvc_snprintf(s, n, format, __VA_ARGS__)
# if _MSC_VER < 1800 && !defined MRB_NO_FLOAT
-# include <float.h>
# define isfinite(n) _finite(n)
# define isnan _isnan
# define isinf(n) (!_finite(n) && !_isnan(n))
diff --git a/mrbgems/mruby-bin-debugger/tools/mrdb/apilist.c b/mrbgems/mruby-bin-debugger/tools/mrdb/apilist.c
index 368ececcf..27db02b48 100644
--- a/mrbgems/mruby-bin-debugger/tools/mrdb/apilist.c
+++ b/mrbgems/mruby-bin-debugger/tools/mrdb/apilist.c
@@ -3,7 +3,6 @@
*/
#include <ctype.h>
-#include <stdlib.h>
#include <string.h>
#include "mrdb.h"
diff --git a/mrbgems/mruby-compiler/core/codegen.c b/mrbgems/mruby-compiler/core/codegen.c
index c0d39dcb7..026745e39 100644
--- a/mrbgems/mruby-compiler/core/codegen.c
+++ b/mrbgems/mruby-compiler/core/codegen.c
@@ -5,7 +5,6 @@
*/
#include <ctype.h>
-#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <mruby.h>
diff --git a/mrbgems/mruby-io/src/file.c b/mrbgems/mruby-io/src/file.c
index b9e1eca03..6c62db662 100644
--- a/mrbgems/mruby-io/src/file.c
+++ b/mrbgems/mruby-io/src/file.c
@@ -14,7 +14,6 @@
#include <sys/stat.h>
#include <fcntl.h>
-#include <limits.h>
#include <errno.h>
#include <stdlib.h>
diff --git a/mrbgems/mruby-math/src/math.c b/mrbgems/mruby-math/src/math.c
index 0b85b1763..8eccc03e5 100644
--- a/mrbgems/mruby-math/src/math.c
+++ b/mrbgems/mruby-math/src/math.c
@@ -25,8 +25,6 @@ domain_error(mrb_state *mrb, const char *func)
/* math functions not provided by Microsoft Visual C++ 2012 or older */
#if defined _MSC_VER && _MSC_VER <= 1700
-#include <float.h>
-
double
asinh(double x)
{
diff --git a/mrbgems/mruby-numeric-ext/src/numeric_ext.c b/mrbgems/mruby-numeric-ext/src/numeric_ext.c
index 00b13174f..b85f9b163 100644
--- a/mrbgems/mruby-numeric-ext/src/numeric_ext.c
+++ b/mrbgems/mruby-numeric-ext/src/numeric_ext.c
@@ -1,4 +1,3 @@
-#include <limits.h>
#include <mruby.h>
#include <mruby/numeric.h>
#include <mruby/presym.h>
diff --git a/mrbgems/mruby-print/src/print.c b/mrbgems/mruby-print/src/print.c
index c98bfb7bf..789808deb 100644
--- a/mrbgems/mruby-print/src/print.c
+++ b/mrbgems/mruby-print/src/print.c
@@ -6,7 +6,6 @@
#include <mruby/string.h>
#include <string.h>
-#include <stdlib.h>
#if defined(_WIN32)
# include <windows.h>
# include <io.h>
diff --git a/mrbgems/mruby-random/src/random.c b/mrbgems/mruby-random/src/random.c
index 9712fbd7e..a1f44f105 100644
--- a/mrbgems/mruby-random/src/random.c
+++ b/mrbgems/mruby-random/src/random.c
@@ -22,8 +22,6 @@ worldwide. This software is distributed without any warranty.
See <https://creativecommons.org/publicdomain/zero/1.0/>. */
-#include <stdint.h>
-
/* This is xoshiro128++ 1.0, one of our 32-bit all-purpose, rock-solid
generators. It has excellent speed, a state size (128 bits) that is
large enough for mild parallelism, and it passes all tests we are aware
diff --git a/mrbgems/mruby-socket/src/socket.c b/mrbgems/mruby-socket/src/socket.c
index c7de66d41..a7a06e6ef 100644
--- a/mrbgems/mruby-socket/src/socket.c
+++ b/mrbgems/mruby-socket/src/socket.c
@@ -31,7 +31,6 @@
typedef size_t fsize_t;
#endif
-#include <stddef.h>
#include <string.h>
#include "mruby.h"
diff --git a/mrbgems/mruby-sprintf/src/sprintf.c b/mrbgems/mruby-sprintf/src/sprintf.c
index ea9d74d95..362d24651 100644
--- a/mrbgems/mruby-sprintf/src/sprintf.c
+++ b/mrbgems/mruby-sprintf/src/sprintf.c
@@ -5,7 +5,6 @@
*/
#include <mruby.h>
-#include <limits.h>
#include <string.h>
#include <mruby/string.h>
#include <mruby/hash.h>
diff --git a/mrbgems/mruby-time/src/time.c b/mrbgems/mruby-time/src/time.c
index 299d4d7e1..ce822b1f4 100644
--- a/mrbgems/mruby-time/src/time.c
+++ b/mrbgems/mruby-time/src/time.c
@@ -20,6 +20,7 @@
#include <string.h>
#endif
+
#include <stdlib.h>
#ifndef _WIN32
#include <unistd.h>
diff --git a/src/class.c b/src/class.c
index 33a610c26..cf438d55e 100644
--- a/src/class.c
+++ b/src/class.c
@@ -4,7 +4,6 @@
** See Copyright Notice in mruby.h
*/
-#include <stdarg.h>
#include <mruby.h>
#include <mruby/array.h>
#include <mruby/hash.h>
diff --git a/src/dump.c b/src/dump.c
index 628c3dbc4..94d5cf74d 100644
--- a/src/dump.c
+++ b/src/dump.c
@@ -5,7 +5,6 @@
*/
#include <string.h>
-#include <limits.h>
#include <math.h>
#include <mruby/dump.h>
#include <mruby/string.h>
diff --git a/src/error.c b/src/error.c
index 7953deea7..45e118b96 100644
--- a/src/error.c
+++ b/src/error.c
@@ -5,7 +5,6 @@
*/
#include <errno.h>
-#include <stdarg.h>
#include <stdlib.h>
#include <mruby.h>
#include <mruby/array.h>
diff --git a/src/fmt_fp.c b/src/fmt_fp.c
index 43daf2307..bac62b88a 100644
--- a/src/fmt_fp.c
+++ b/src/fmt_fp.c
@@ -1,6 +1,5 @@
#include <mruby.h>
#include <string.h>
-#include <stdlib.h>
#ifndef MRB_NO_FLOAT
/***********************************************************************
diff --git a/src/gc.c b/src/gc.c
index bcd0b29b6..a40bd8545 100644
--- a/src/gc.c
+++ b/src/gc.c
@@ -5,7 +5,6 @@
*/
#include <string.h>
-#include <stdlib.h>
#ifdef MRB_USE_MALLOC_TRIM
#include <malloc.h>
#endif
@@ -24,6 +23,10 @@
#include <mruby/throw.h>
#include <mruby/presym.h>
+#ifdef MRB_GC_STRESS
+#include <stdlib.h>
+#endif
+
/*
= Tri-color Incremental Garbage Collection
diff --git a/src/load.c b/src/load.c
index bd0811743..83e06f1f8 100644
--- a/src/load.c
+++ b/src/load.c
@@ -4,8 +4,6 @@
** See Copyright Notice in mruby.h
*/
-#include <limits.h>
-#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <mruby/dump.h>
diff --git a/src/numeric.c b/src/numeric.c
index b22026ebb..17f5ac1bc 100644
--- a/src/numeric.c
+++ b/src/numeric.c
@@ -5,11 +5,8 @@
*/
#ifndef MRB_NO_FLOAT
-#include <float.h>
#include <math.h>
#endif
-#include <limits.h>
-#include <stdlib.h>
#include <string.h>
#include <mruby.h>
diff --git a/src/readflt.c b/src/readflt.c
index 19a8e8dc6..b320a43c1 100644
--- a/src/readflt.c
+++ b/src/readflt.c
@@ -20,7 +20,6 @@ My modifications in this file are also placed in the public domain.
Matz (Yukihiro Matsumoto)
*/
-#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <errno.h>
diff --git a/src/string.c b/src/string.c
index 03d9c8a9c..2258cc218 100644
--- a/src/string.c
+++ b/src/string.c
@@ -8,14 +8,6 @@
# define _CRT_NONSTDC_NO_DEPRECATE
#endif
-#ifndef MRB_NO_FLOAT
-#include <float.h>
-#include <math.h>
-#endif
-#include <limits.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
#include <mruby.h>
#include <mruby/array.h>
#include <mruby/class.h>
@@ -23,6 +15,10 @@
#include <mruby/string.h>
#include <mruby/numeric.h>
#include <mruby/presym.h>
+#ifndef MRB_NO_FLOAT
+#include <math.h>
+#endif
+#include <string.h>
typedef struct mrb_shared_string {
int refcnt;
diff --git a/src/symbol.c b/src/symbol.c
index 007b8c885..5b05f1a9f 100644
--- a/src/symbol.c
+++ b/src/symbol.c
@@ -4,7 +4,6 @@
** See Copyright Notice in mruby.h
*/
-#include <limits.h>
#include <string.h>
#include <mruby.h>
#include <mruby/khash.h>
diff --git a/src/vm.c b/src/vm.c
index cd70faf11..d52d690f5 100644
--- a/src/vm.c
+++ b/src/vm.c
@@ -4,11 +4,6 @@
** See Copyright Notice in mruby.h
*/
-#include <stddef.h>
-#include <stdarg.h>
-#ifndef MRB_NO_FLOAT
-#include <math.h>
-#endif
#include <mruby.h>
#include <mruby/array.h>
#include <mruby/class.h>
@@ -25,6 +20,9 @@
#include <mruby/throw.h>
#include <mruby/dump.h>
#include <mruby/presym.h>
+#ifndef MRB_NO_FLOAT
+#include <math.h>
+#endif
#ifdef MRB_NO_STDIO
#if defined(__cplusplus)