Skip to content

Commit

Permalink
py: Clean up includes.
Browse files Browse the repository at this point in the history
Remove unnecessary includes. Add includes that improve portability.
  • Loading branch information
xbe committed Mar 17, 2014
1 parent c93a221 commit efe3422
Show file tree
Hide file tree
Showing 58 changed files with 19 additions and 111 deletions.
1 change: 0 additions & 1 deletion py/asmthumb.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include <stdint.h>
#include <stdio.h>
#include <assert.h>
#include <string.h>
Expand Down
1 change: 0 additions & 1 deletion py/binary.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include <stdlib.h>
#include <stdint.h>
#include <assert.h>

Expand Down
4 changes: 0 additions & 4 deletions py/builtin.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <assert.h>

#include "nlr.h"
Expand Down
5 changes: 0 additions & 5 deletions py/builtinevex.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <assert.h>

#include "nlr.h"
#include "misc.h"
Expand Down
1 change: 0 additions & 1 deletion py/builtinimport.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <assert.h>

Expand Down
1 change: 0 additions & 1 deletion py/builtinmath.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include <stdint.h>
#include <math.h>

#include "misc.h"
Expand Down
1 change: 0 additions & 1 deletion py/builtinmp.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include <stdint.h>

#include "misc.h"
#include "mpconfig.h"
Expand Down
3 changes: 1 addition & 2 deletions py/compile.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include <unistd.h>
#include <stdlib.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
Expand Down
3 changes: 1 addition & 2 deletions py/emitbc.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include <unistd.h>
#include <stdlib.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
Expand Down
2 changes: 0 additions & 2 deletions py/emitcommon.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include <unistd.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <assert.h>

#include "misc.h"
Expand Down
3 changes: 1 addition & 2 deletions py/emitcpy.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include <unistd.h>
#include <stdlib.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
Expand Down
2 changes: 0 additions & 2 deletions py/emitinlinethumb.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#include <unistd.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
Expand Down
3 changes: 1 addition & 2 deletions py/emitnative.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@

// for x in l[0:8]: can be compiled into a native loop if l has pointer type

#include <unistd.h>
#include <stdlib.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
Expand Down
3 changes: 0 additions & 3 deletions py/emitpass1.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#include <unistd.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>

#include "misc.h"
Expand Down
1 change: 0 additions & 1 deletion py/formatfloat.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
***********************************************************************/

#include <stdint.h>
#include <stdlib.h>

#include "mpconfig.h"
Expand Down
1 change: 0 additions & 1 deletion py/gc.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>

#include "mpconfig.h"
Expand Down
2 changes: 1 addition & 1 deletion py/lexer.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* lexer.c -- simple tokeniser for Python implementation
*/

#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>

#include "misc.h"
Expand Down
2 changes: 0 additions & 2 deletions py/lexerstr.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#include <stdint.h>
#include <stdio.h>

#include "misc.h"
#include "mpconfig.h"
Expand Down
4 changes: 3 additions & 1 deletion py/lexerunix.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include <stdint.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
Expand All @@ -11,6 +10,9 @@

#if MICROPY_ENABLE_LEXER_UNIX

#include <sys/stat.h>
#include <sys/types.h>

mp_lexer_t *mp_lexer_new_from_file(const char *filename) {
int fd = open(filename, O_RDONLY);
if (fd < 0) {
Expand Down
1 change: 1 addition & 0 deletions py/malloc.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Expand Down
2 changes: 0 additions & 2 deletions py/map.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#include <stdint.h>
#include <stdlib.h>
#include <assert.h>

#include "misc.h"
#include "mpconfig.h"
Expand Down
3 changes: 0 additions & 3 deletions py/obj.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <assert.h>

#include "nlr.h"
Expand Down
3 changes: 0 additions & 3 deletions py/objarray.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <stdarg.h>
#include <assert.h>

#include "nlr.h"
Expand Down
2 changes: 0 additions & 2 deletions py/objbool.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#include <stdlib.h>
#include <stdint.h>

#include "nlr.h"
#include "misc.h"
Expand Down
3 changes: 0 additions & 3 deletions py/objboundmeth.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>

#include "nlr.h"
#include "misc.h"
Expand Down
3 changes: 0 additions & 3 deletions py/objcell.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#include <stdlib.h>
#include <stdint.h>
#include <assert.h>

#include "nlr.h"
#include "misc.h"
Expand Down
3 changes: 0 additions & 3 deletions py/objclosure.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <assert.h>

#include "nlr.h"
#include "misc.h"
Expand Down
2 changes: 0 additions & 2 deletions py/objcomplex.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <assert.h>

#include "nlr.h"
Expand Down
3 changes: 1 addition & 2 deletions py/objdict.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include <assert.h>

Expand Down
1 change: 0 additions & 1 deletion py/objenumerate.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include <stdlib.h>
#include <assert.h>

#include "misc.h"
Expand Down
2 changes: 0 additions & 2 deletions py/objexcept.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <stdarg.h>
#include <assert.h>
Expand Down
1 change: 0 additions & 1 deletion py/objfilter.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include <stdlib.h>
#include <assert.h>

#include "nlr.h"
Expand Down
2 changes: 0 additions & 2 deletions py/objfloat.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <assert.h>

#include "nlr.h"
Expand Down
2 changes: 1 addition & 1 deletion py/objfun.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <stdbool.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <assert.h>

Expand Down
2 changes: 0 additions & 2 deletions py/objgenerator.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <assert.h>

#include "nlr.h"
Expand Down
2 changes: 0 additions & 2 deletions py/objgetitemiter.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#include <stdlib.h>
#include <stdint.h>

#include "nlr.h"
#include "misc.h"
Expand Down
2 changes: 0 additions & 2 deletions py/objint.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <assert.h>

#include "nlr.h"
Expand Down
2 changes: 0 additions & 2 deletions py/objint_longlong.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <assert.h>

#include "nlr.h"
#include "misc.h"
Expand Down
2 changes: 0 additions & 2 deletions py/objint_mpz.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <assert.h>

#include "nlr.h"
#include "misc.h"
Expand Down
2 changes: 0 additions & 2 deletions py/objlist.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <assert.h>

Expand Down
1 change: 0 additions & 1 deletion py/objmap.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include <stdlib.h>
#include <assert.h>

#include "nlr.h"
Expand Down
2 changes: 0 additions & 2 deletions py/objmodule.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <assert.h>

#include "nlr.h"
Expand Down
1 change: 0 additions & 1 deletion py/objnone.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include <stdlib.h>
#include <stdint.h>

#include "nlr.h"
#include "misc.h"
Expand Down
2 changes: 0 additions & 2 deletions py/objrange.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#include <stdlib.h>
#include <stdint.h>

#include "nlr.h"
#include "misc.h"
Expand Down
3 changes: 1 addition & 2 deletions py/objset.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include <assert.h>

Expand Down
2 changes: 0 additions & 2 deletions py/objslice.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <assert.h>

#include "nlr.h"
Expand Down
4 changes: 1 addition & 3 deletions py/objstr.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#include <stdlib.h>
#include <stdint.h>
#include <stdarg.h>
#include <stdbool.h>
#include <string.h>
#include <assert.h>

Expand Down
2 changes: 0 additions & 2 deletions py/objtuple.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <assert.h>

#include "nlr.h"
Expand Down
2 changes: 0 additions & 2 deletions py/objtype.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <assert.h>

Expand Down
5 changes: 1 addition & 4 deletions py/parse.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#include <unistd.h>
#include <stdlib.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <assert.h>

#include "misc.h"
Expand Down
1 change: 1 addition & 0 deletions py/parsenum.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <stdbool.h>
#include <stdlib.h>

#include "misc.h"
Expand Down
2 changes: 0 additions & 2 deletions py/runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
Expand Down
2 changes: 1 addition & 1 deletion py/scope.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>

#include "misc.h"
Expand Down
4 changes: 1 addition & 3 deletions py/sequence.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include <assert.h>

#include "nlr.h"
#include "misc.h"
Expand Down
Loading

0 comments on commit efe3422

Please sign in to comment.