From efe34223945a5d27a7ae9445d0793d6330cd2411 Mon Sep 17 00:00:00 2001 From: xbe Date: Sun, 16 Mar 2014 00:14:26 -0700 Subject: [PATCH] py: Clean up includes. Remove unnecessary includes. Add includes that improve portability. --- py/asmthumb.c | 1 - py/binary.c | 1 - py/builtin.c | 4 ---- py/builtinevex.c | 5 ----- py/builtinimport.c | 1 - py/builtinmath.c | 1 - py/builtinmp.c | 1 - py/compile.c | 3 +-- py/emitbc.c | 3 +-- py/emitcommon.c | 2 -- py/emitcpy.c | 3 +-- py/emitinlinethumb.c | 2 -- py/emitnative.c | 3 +-- py/emitpass1.c | 3 --- py/formatfloat.c | 1 - py/gc.c | 1 - py/lexer.c | 2 +- py/lexerstr.c | 2 -- py/lexerunix.c | 4 +++- py/malloc.c | 1 + py/map.c | 2 -- py/obj.c | 3 --- py/objarray.c | 3 --- py/objbool.c | 2 -- py/objboundmeth.c | 3 --- py/objcell.c | 3 --- py/objclosure.c | 3 --- py/objcomplex.c | 2 -- py/objdict.c | 3 +-- py/objenumerate.c | 1 - py/objexcept.c | 2 -- py/objfilter.c | 1 - py/objfloat.c | 2 -- py/objfun.c | 2 +- py/objgenerator.c | 2 -- py/objgetitemiter.c | 2 -- py/objint.c | 2 -- py/objint_longlong.c | 2 -- py/objint_mpz.c | 2 -- py/objlist.c | 2 -- py/objmap.c | 1 - py/objmodule.c | 2 -- py/objnone.c | 1 - py/objrange.c | 2 -- py/objset.c | 3 +-- py/objslice.c | 2 -- py/objstr.c | 4 +--- py/objtuple.c | 2 -- py/objtype.c | 2 -- py/parse.c | 5 +---- py/parsenum.c | 1 + py/runtime.c | 2 -- py/scope.c | 2 +- py/sequence.c | 4 +--- py/showbc.c | 3 --- py/stream.c | 2 +- py/vm.c | 3 --- py/vstr.c | 1 + 58 files changed, 19 insertions(+), 111 deletions(-) diff --git a/py/asmthumb.c b/py/asmthumb.c index 1e6c23e2ee..3fcd28a91d 100644 --- a/py/asmthumb.c +++ b/py/asmthumb.c @@ -1,4 +1,3 @@ -#include #include #include #include diff --git a/py/binary.c b/py/binary.c index 20b38b8b14..7a8ed46111 100644 --- a/py/binary.c +++ b/py/binary.c @@ -1,4 +1,3 @@ -#include #include #include diff --git a/py/builtin.c b/py/builtin.c index df488e054a..2e0627fa5f 100644 --- a/py/builtin.c +++ b/py/builtin.c @@ -1,8 +1,4 @@ -#include -#include #include -#include -#include #include #include "nlr.h" diff --git a/py/builtinevex.c b/py/builtinevex.c index 6e920e85f0..d658db0adf 100644 --- a/py/builtinevex.c +++ b/py/builtinevex.c @@ -1,9 +1,4 @@ #include -#include -#include -#include -#include -#include #include "nlr.h" #include "misc.h" diff --git a/py/builtinimport.c b/py/builtinimport.c index 7cbb46012b..2b9b3a30b9 100644 --- a/py/builtinimport.c +++ b/py/builtinimport.c @@ -1,7 +1,6 @@ #include #include #include -#include #include #include diff --git a/py/builtinmath.c b/py/builtinmath.c index 35c1e45edc..eeb715048a 100644 --- a/py/builtinmath.c +++ b/py/builtinmath.c @@ -1,4 +1,3 @@ -#include #include #include "misc.h" diff --git a/py/builtinmp.c b/py/builtinmp.c index 22091f4ea5..3b73517963 100644 --- a/py/builtinmp.c +++ b/py/builtinmp.c @@ -1,4 +1,3 @@ -#include #include "misc.h" #include "mpconfig.h" diff --git a/py/compile.c b/py/compile.c index d1aec30958..bb688d5d8e 100644 --- a/py/compile.c +++ b/py/compile.c @@ -1,5 +1,4 @@ -#include -#include +#include #include #include #include diff --git a/py/emitbc.c b/py/emitbc.c index b26da0e706..ef5da3a622 100644 --- a/py/emitbc.c +++ b/py/emitbc.c @@ -1,5 +1,4 @@ -#include -#include +#include #include #include #include diff --git a/py/emitcommon.c b/py/emitcommon.c index ff6457289a..f7494668e0 100644 --- a/py/emitcommon.c +++ b/py/emitcommon.c @@ -1,7 +1,5 @@ #include -#include #include -#include #include #include "misc.h" diff --git a/py/emitcpy.c b/py/emitcpy.c index b31425f2ec..afd5a5af94 100644 --- a/py/emitcpy.c +++ b/py/emitcpy.c @@ -1,5 +1,4 @@ -#include -#include +#include #include #include #include diff --git a/py/emitinlinethumb.c b/py/emitinlinethumb.c index 675ed1efc8..55af97f835 100644 --- a/py/emitinlinethumb.c +++ b/py/emitinlinethumb.c @@ -1,5 +1,3 @@ -#include -#include #include #include #include diff --git a/py/emitnative.c b/py/emitnative.c index df531af6b1..3ed415b04c 100644 --- a/py/emitnative.c +++ b/py/emitnative.c @@ -16,8 +16,7 @@ // for x in l[0:8]: can be compiled into a native loop if l has pointer type -#include -#include +#include #include #include #include diff --git a/py/emitpass1.c b/py/emitpass1.c index d492652399..e4dbf14121 100644 --- a/py/emitpass1.c +++ b/py/emitpass1.c @@ -1,8 +1,5 @@ -#include #include #include -#include -#include #include #include "misc.h" diff --git a/py/formatfloat.c b/py/formatfloat.c index e42266a714..83aee1ef74 100644 --- a/py/formatfloat.c +++ b/py/formatfloat.c @@ -13,7 +13,6 @@ ***********************************************************************/ -#include #include #include "mpconfig.h" diff --git a/py/gc.c b/py/gc.c index e0941af01f..67f1e810e0 100644 --- a/py/gc.c +++ b/py/gc.c @@ -1,6 +1,5 @@ #include #include -#include #include #include "mpconfig.h" diff --git a/py/lexer.c b/py/lexer.c index 26fec121c1..58d54b6980 100644 --- a/py/lexer.c +++ b/py/lexer.c @@ -1,9 +1,9 @@ /* lexer.c -- simple tokeniser for Python implementation */ +#include #include #include -#include #include #include "misc.h" diff --git a/py/lexerstr.c b/py/lexerstr.c index 634aa42acd..a2168c96c1 100644 --- a/py/lexerstr.c +++ b/py/lexerstr.c @@ -1,5 +1,3 @@ -#include -#include #include "misc.h" #include "mpconfig.h" diff --git a/py/lexerunix.c b/py/lexerunix.c index fb62d3d72f..73d30f2476 100644 --- a/py/lexerunix.c +++ b/py/lexerunix.c @@ -1,4 +1,3 @@ -#include #include #include #include @@ -11,6 +10,9 @@ #if MICROPY_ENABLE_LEXER_UNIX +#include +#include + mp_lexer_t *mp_lexer_new_from_file(const char *filename) { int fd = open(filename, O_RDONLY); if (fd < 0) { diff --git a/py/malloc.c b/py/malloc.c index 27eaac1088..504db4b1b9 100644 --- a/py/malloc.c +++ b/py/malloc.c @@ -1,3 +1,4 @@ +#include #include #include #include diff --git a/py/map.c b/py/map.c index f41152703e..d1c368c6ae 100644 --- a/py/map.c +++ b/py/map.c @@ -1,6 +1,4 @@ -#include #include -#include #include "misc.h" #include "mpconfig.h" diff --git a/py/obj.c b/py/obj.c index 0f36ef5690..e98dbae6cf 100644 --- a/py/obj.c +++ b/py/obj.c @@ -1,8 +1,5 @@ -#include -#include #include #include -#include #include #include "nlr.h" diff --git a/py/objarray.c b/py/objarray.c index d0b3e003b8..ee43bde960 100644 --- a/py/objarray.c +++ b/py/objarray.c @@ -1,7 +1,4 @@ -#include -#include #include -#include #include #include "nlr.h" diff --git a/py/objbool.c b/py/objbool.c index 1dc5e5760e..9b4af2a31d 100644 --- a/py/objbool.c +++ b/py/objbool.c @@ -1,5 +1,3 @@ -#include -#include #include "nlr.h" #include "misc.h" diff --git a/py/objboundmeth.c b/py/objboundmeth.c index 0b5fc10a07..1b9ac61f24 100644 --- a/py/objboundmeth.c +++ b/py/objboundmeth.c @@ -1,7 +1,4 @@ -#include -#include #include -#include #include "nlr.h" #include "misc.h" diff --git a/py/objcell.c b/py/objcell.c index 3666617474..a6922b018a 100644 --- a/py/objcell.c +++ b/py/objcell.c @@ -1,6 +1,3 @@ -#include -#include -#include #include "nlr.h" #include "misc.h" diff --git a/py/objclosure.c b/py/objclosure.c index e2de0e0451..cd8129e24f 100644 --- a/py/objclosure.c +++ b/py/objclosure.c @@ -1,7 +1,4 @@ -#include -#include #include -#include #include "nlr.h" #include "misc.h" diff --git a/py/objcomplex.c b/py/objcomplex.c index bba89daf00..65957cbf60 100644 --- a/py/objcomplex.c +++ b/py/objcomplex.c @@ -1,6 +1,4 @@ #include -#include -#include #include #include "nlr.h" diff --git a/py/objdict.c b/py/objdict.c index 31a80bd6cb..17cc499c5e 100644 --- a/py/objdict.c +++ b/py/objdict.c @@ -1,5 +1,4 @@ -#include -#include +#include #include #include diff --git a/py/objenumerate.c b/py/objenumerate.c index 1c858ff56f..1862eb74e1 100644 --- a/py/objenumerate.c +++ b/py/objenumerate.c @@ -1,4 +1,3 @@ -#include #include #include "misc.h" diff --git a/py/objexcept.c b/py/objexcept.c index 532ca4320a..11177724da 100644 --- a/py/objexcept.c +++ b/py/objexcept.c @@ -1,5 +1,3 @@ -#include -#include #include #include #include diff --git a/py/objfilter.c b/py/objfilter.c index dc400f1a2f..ea76b99070 100644 --- a/py/objfilter.c +++ b/py/objfilter.c @@ -1,4 +1,3 @@ -#include #include #include "nlr.h" diff --git a/py/objfloat.c b/py/objfloat.c index 04d1278014..401c1145ee 100644 --- a/py/objfloat.c +++ b/py/objfloat.c @@ -1,6 +1,4 @@ #include -#include -#include #include #include "nlr.h" diff --git a/py/objfun.c b/py/objfun.c index 361df19145..7d49f18da4 100644 --- a/py/objfun.c +++ b/py/objfun.c @@ -1,5 +1,5 @@ +#include #include -#include #include #include diff --git a/py/objgenerator.c b/py/objgenerator.c index 6a03af856b..8c4bb595f1 100644 --- a/py/objgenerator.c +++ b/py/objgenerator.c @@ -1,6 +1,4 @@ #include -#include -#include #include #include "nlr.h" diff --git a/py/objgetitemiter.c b/py/objgetitemiter.c index bf466c05d9..08ef66f29f 100644 --- a/py/objgetitemiter.c +++ b/py/objgetitemiter.c @@ -1,5 +1,3 @@ -#include -#include #include "nlr.h" #include "misc.h" diff --git a/py/objint.c b/py/objint.c index 7a9b0366db..9cba1ce744 100644 --- a/py/objint.c +++ b/py/objint.c @@ -1,6 +1,4 @@ -#include #include -#include #include #include "nlr.h" diff --git a/py/objint_longlong.c b/py/objint_longlong.c index eca2951be6..58c2466fd0 100644 --- a/py/objint_longlong.c +++ b/py/objint_longlong.c @@ -1,7 +1,5 @@ #include #include -#include -#include #include "nlr.h" #include "misc.h" diff --git a/py/objint_mpz.c b/py/objint_mpz.c index e8e8b85472..8b7ed78a2c 100644 --- a/py/objint_mpz.c +++ b/py/objint_mpz.c @@ -1,7 +1,5 @@ -#include #include #include -#include #include "nlr.h" #include "misc.h" diff --git a/py/objlist.c b/py/objlist.c index aa082ea34b..f43670d603 100644 --- a/py/objlist.c +++ b/py/objlist.c @@ -1,5 +1,3 @@ -#include -#include #include #include diff --git a/py/objmap.c b/py/objmap.c index cbaef6fb9a..2b356ec4ea 100644 --- a/py/objmap.c +++ b/py/objmap.c @@ -1,4 +1,3 @@ -#include #include #include "nlr.h" diff --git a/py/objmodule.c b/py/objmodule.c index 791932dc7f..e0778b4cf2 100644 --- a/py/objmodule.c +++ b/py/objmodule.c @@ -1,6 +1,4 @@ #include -#include -#include #include #include "nlr.h" diff --git a/py/objnone.c b/py/objnone.c index 489d34d138..a4370efebc 100644 --- a/py/objnone.c +++ b/py/objnone.c @@ -1,5 +1,4 @@ #include -#include #include "nlr.h" #include "misc.h" diff --git a/py/objrange.c b/py/objrange.c index 80c5928385..f80bc08602 100644 --- a/py/objrange.c +++ b/py/objrange.c @@ -1,5 +1,3 @@ -#include -#include #include "nlr.h" #include "misc.h" diff --git a/py/objset.c b/py/objset.c index aea107fc1c..437bae9bf8 100644 --- a/py/objset.c +++ b/py/objset.c @@ -1,5 +1,4 @@ -#include -#include +#include #include #include diff --git a/py/objslice.c b/py/objslice.c index 10df671fea..46cce264a9 100644 --- a/py/objslice.c +++ b/py/objslice.c @@ -1,6 +1,4 @@ #include -#include -#include #include #include "nlr.h" diff --git a/py/objstr.c b/py/objstr.c index 64ba6c5fad..9762b0efd2 100644 --- a/py/objstr.c +++ b/py/objstr.c @@ -1,6 +1,4 @@ -#include -#include -#include +#include #include #include diff --git a/py/objtuple.c b/py/objtuple.c index 827441f704..83d1f21cea 100644 --- a/py/objtuple.c +++ b/py/objtuple.c @@ -1,6 +1,4 @@ #include -#include -#include #include #include "nlr.h" diff --git a/py/objtype.c b/py/objtype.c index 6480a99f6c..4898c5ccb4 100644 --- a/py/objtype.c +++ b/py/objtype.c @@ -1,5 +1,3 @@ -#include -#include #include #include diff --git a/py/parse.c b/py/parse.c index a7b73a5673..1381f1293d 100644 --- a/py/parse.c +++ b/py/parse.c @@ -1,9 +1,6 @@ -#include -#include +#include #include #include -#include -#include #include #include "misc.h" diff --git a/py/parsenum.c b/py/parsenum.c index 8e290da338..c9cef5fcd8 100644 --- a/py/parsenum.c +++ b/py/parsenum.c @@ -1,3 +1,4 @@ +#include #include #include "misc.h" diff --git a/py/runtime.c b/py/runtime.c index bd6f2289de..9c8ba636c0 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -2,8 +2,6 @@ // mp_xxx functions are safer and can be called by anyone // note that rt_assign_xxx are called only from emit*, and maybe we can rename them to reflect this -#include -#include #include #include #include diff --git a/py/scope.c b/py/scope.c index fc12fb5da0..cc4be7c85d 100644 --- a/py/scope.c +++ b/py/scope.c @@ -1,6 +1,6 @@ +#include #include #include -#include #include #include "misc.h" diff --git a/py/sequence.c b/py/sequence.c index 1723bb416c..184c34e0b8 100644 --- a/py/sequence.c +++ b/py/sequence.c @@ -1,7 +1,5 @@ -#include -#include +#include #include -#include #include "nlr.h" #include "misc.h" diff --git a/py/showbc.c b/py/showbc.c index 609048e8f6..bc81086c7d 100644 --- a/py/showbc.c +++ b/py/showbc.c @@ -1,7 +1,4 @@ -#include -#include #include -#include #include #include "misc.h" diff --git a/py/stream.c b/py/stream.c index 59877d7242..7c97ee10c3 100644 --- a/py/stream.c +++ b/py/stream.c @@ -1,4 +1,4 @@ -#include +#include #include "nlr.h" #include "misc.h" diff --git a/py/vm.c b/py/vm.c index 77762a13af..7b78b5fefb 100644 --- a/py/vm.c +++ b/py/vm.c @@ -1,7 +1,4 @@ -#include -#include #include -#include #include #include "nlr.h" diff --git a/py/vstr.c b/py/vstr.c index c518fa7048..032acc61bc 100644 --- a/py/vstr.c +++ b/py/vstr.c @@ -1,3 +1,4 @@ +#include #include #include #include