Commit aa655b9e authored by cremno's avatar cremno

remove superfluous includes

- reduce compile time by a little bit (full-core: ~0.7s for me)
- thanks to 'include-what-you-use' for some help
- include Standard C header files before any other (coding style)
parent cff4ac6b
......@@ -8,21 +8,17 @@
#include <stdlib.h>
#include <string.h>
#include <mruby.h>
#include "mruby.h"
#include "mruby/array.h"
#include <mruby/proc.h>
#include <mruby/data.h>
#include <mruby/compile.h>
#include "mruby/proc.h"
#include "mruby/compile.h"
#include "mruby/string.h"
#ifdef ENABLE_READLINE
#include <limits.h>
#include <readline/readline.h>
#include <readline/history.h>
#endif
#include <mruby/string.h>
#ifdef ENABLE_READLINE
static const char *history_file_name = ".mirb_history";
char history_path[PATH_MAX];
#endif
......
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "mruby.h"
#include "mruby/proc.h"
#include "mruby/array.h"
#include "mruby/string.h"
#include "mruby/compile.h"
#include "mruby/dump.h"
#include "mruby/variable.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifndef ENABLE_STDIO
static void
......
......@@ -6,11 +6,8 @@
#include "mruby.h"
#include "mruby/array.h"
#include "mruby/class.h"
#include "mruby/hash.h"
#include "mruby/khash.h"
#include "mruby/string.h"
#include "mruby/variable.h"
/*
* call-seq:
......
#include <limits.h>
#include "mruby.h"
#include "mruby/numeric.h"
static mrb_value
mrb_int_chr(mrb_state *mrb, mrb_value x)
......
......@@ -4,7 +4,6 @@
** See Copyright Notice in mruby.h
*/
#include <stdio.h>
#include "mt19937ar.h"
/* Period parameters */
......
#include "mruby.h"
#include "mruby/string.h"
#include <ctype.h>
#include <string.h>
#include "mruby.h"
#include "mruby/string.h"
static mrb_value
mrb_str_getbyte(mrb_state *mrb, mrb_value str)
......
......@@ -10,7 +10,6 @@
#include "mruby/array.h"
#include "mruby/string.h"
#include "mruby/class.h"
#include "mruby/data.h"
#include "mruby/variable.h"
#define RSTRUCT_ARY(st) mrb_ary_ptr(st)
......
#include "mruby.h"
#include "mruby/irep.h"
#include "mruby/dump.h"
#include "mruby/string.h"
#include "mruby/proc.h"
extern const uint8_t mrblib_irep[];
......
......@@ -4,7 +4,6 @@
** See Copyright Notice in mruby.h
*/
#include <limits.h>
#include "mruby.h"
#include "mruby/array.h"
#include "mruby/class.h"
......
......@@ -4,6 +4,7 @@
** See Copyright Notice in mruby.h
*/
#include <stdarg.h>
#include "mruby.h"
#include "mruby/variable.h"
#include "mruby/proc.h"
......@@ -11,7 +12,6 @@
#include "mruby/string.h"
#include "mruby/class.h"
#include "mruby/debug.h"
#include <stdarg.h>
typedef void (*output_stream_func)(mrb_state*, void*, int, const char*, ...);
......
......@@ -4,9 +4,9 @@
** See Copyright Notice in mruby.h
*/
#include "mruby.h"
#include <stdarg.h>
#include <ctype.h>
#include <stdarg.h>
#include "mruby.h"
#include "mruby/array.h"
#include "mruby/class.h"
#include "mruby/numeric.h"
......
......@@ -4,10 +4,9 @@
** See Copyright Notice in mruby.h
*/
#include <ctype.h>
#include <string.h>
#include "mruby/dump.h"
#include <ctype.h>
#include "mruby/string.h"
#include "mruby/irep.h"
#include "mruby/numeric.h"
......
......@@ -7,10 +7,8 @@
#include <errno.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include "mruby.h"
#include "mruby/array.h"
#include "mruby/class.h"
#include "mruby/irep.h"
#include "mruby/proc.h"
#include "mruby/string.h"
......
......@@ -6,8 +6,6 @@
#include "mruby.h"
#include "mruby/string.h"
#include "error.h"
#include "mruby/numeric.h"
#include "mruby/data.h"
#include "mruby/class.h"
......
......@@ -4,7 +4,6 @@
** See Copyright Notice in mruby.h
*/
#include <limits.h>
#include <string.h>
#include <stdlib.h>
#include "mruby.h"
......
......@@ -5,11 +5,9 @@
*/
#include "mruby.h"
#include "mruby/array.h"
#include "mruby/class.h"
#include "mruby/numeric.h"
#include "mruby/string.h"
#include "error.h"
mrb_bool
mrb_obj_eq(mrb_state *mrb, mrb_value v1, mrb_value v2)
......
......@@ -7,7 +7,6 @@
#include <stdlib.h>
#include <string.h>
#include "mruby.h"
#include "mruby/class.h"
#include "mruby/irep.h"
#include "mruby/variable.h"
#include "mruby/debug.h"
......
......@@ -5,7 +5,6 @@
*/
#include <ctype.h>
#include <limits.h>
#include <string.h>
#include "mruby.h"
#include "mruby/khash.h"
......
......@@ -4,14 +4,12 @@
** See Copyright Notice in mruby.h
*/
#include <ctype.h>
#include "mruby.h"
#include "mruby/array.h"
#include "mruby/class.h"
#include "mruby/proc.h"
#include "mruby/string.h"
#include "mruby/variable.h"
#include "error.h"
#include <ctype.h>
typedef int (iv_foreach_func)(mrb_state*,mrb_sym,mrb_value,void*);
......
......@@ -4,7 +4,6 @@
** See Copyright Notice in mruby.h
*/
#include <string.h>
#include <setjmp.h>
#include <stddef.h>
#include <stdarg.h>
......@@ -13,7 +12,6 @@
#include "mruby/class.h"
#include "mruby/hash.h"
#include "mruby/irep.h"
#include "mruby/numeric.h"
#include "mruby/proc.h"
#include "mruby/range.h"
#include "mruby/string.h"
......
......@@ -149,7 +149,7 @@ module MRuby
end
end # generate_gem_init
def print_gem_init_header(f)
def print_gem_comment(f)
f.puts %Q[/*]
f.puts %Q[ * This file is loading the irep]
f.puts %Q[ * Ruby GEM code.]
......@@ -158,15 +158,23 @@ module MRuby
f.puts %Q[ * This file was generated!]
f.puts %Q[ * All manual changes will get lost.]
f.puts %Q[ */]
end
def print_gem_init_header(f)
print_gem_comment(f)
f.puts %Q[#include <stdlib.h>] unless rbfiles.empty?
f.puts %Q[#include "mruby.h"]
f.puts %Q[#include "mruby/irep.h"] unless rbfiles.empty?
end
def print_gem_test_header(f)
print_gem_comment(f)
f.puts %Q[#include <stdlib.h>]
f.puts %Q[#include "mruby.h"]
f.puts %Q[#include "mruby/array.h"]
f.puts %Q[#include "mruby/irep.h"]
f.puts %Q[#include "mruby/dump.h"]
f.puts %Q[#include "mruby/string.h"]
f.puts %Q[#include "mruby/proc.h"]
f.puts %Q[#include "mruby/variable.h"]
f.puts %Q[#include "mruby/array.h"]
f.puts %Q[#include "mruby/hash.h"]
end
def version_ok?(req_versions)
......
......@@ -5,7 +5,7 @@ MRuby.each_target do
file test_rbobj => g.test_rbireps
file g.test_rbireps => [g.test_rbfiles].flatten + [g.build.mrbcfile] do |t|
open(t.name, 'w') do |f|
g.print_gem_init_header(f)
g.print_gem_test_header(f)
test_preload = [g.dir, MRUBY_ROOT].map {|dir|
File.expand_path(g.test_preload, dir)
}.find {|file| File.exist?(file) }
......
#include <stdlib.h>
#include "mruby.h"
#include "mruby/irep.h"
#include "mruby/dump.h"
#include "mruby/string.h"
#include "mruby/proc.h"
extern const uint8_t mrbtest_irep[];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment