Morgan243 / python-on-a-chip

Automatically exported from code.google.com/p/python-on-a-chip
Other
0 stars 0 forks source link

Remove stdio.h headers references in Virtual Machine code #215

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Try to compile with gcc options -nostdinc -fno-builtin

What is the expected output?
Compilation without errors and without any reference to standard system 
libraries.

What do you see instead?
Several error regarding to printf (thanks to C_DEBUG_PRINT macro at pm.h) and 
snprintf (at float.h).

What version of the product are you using? On what operating system?
SVN v0.9 (latest stable) on Ubuntu 11.04, 64 bits

Please provide any additional information below.
I'm triying to make a port for multiboot-x86 of PyMite, so i should compile 
without any reference to system libraries. I know that system headers doesn't 
do any bad (they are only functions definitions), but since PyMite sould work 
in it's own, i think a small stdio.h file should be added using the plat.c 
declared function 'plat_putByte', or better than this, using it directly.

Files at virtual machine code using printf are:
* bytearray.c
* float.c
* heap.c
* int.c
* obj.c
* strobj.c

Original issue reported on code.google.com by piranna on 2 Oct 2011 at 7:35

GoogleCodeExporter commented 8 years ago
Relocated "#include <stdio.h>"  in pm.h to be inside "#if __DEBUG__"
Relocated "#include <stdio.h>" in float.c to be inside HAVE_FLOAT and 
HAVE_PRINT so that snprintf may be used.
Removed printf from inside native code in t374.py because it wasn't necessary 
for proper functioning of the test.

Original comment by dwhall...@gmail.com on 28 Nov 2011 at 3:18

GoogleCodeExporter commented 8 years ago
The v10 branch by default applies code from within former HAVE_PRINT blocks.  
Several of these code blocks use snprintf.  So stdio.h is required for the v10 
branch.  I haven't found a clever workaround yet.

This issue was resolved for the default branch by rba35dcfecc70

Original comment by dwhall...@gmail.com on 28 Nov 2011 at 5:02

GoogleCodeExporter commented 8 years ago
Could you be able to point out the problematic lines?

Original comment by piranna on 28 Nov 2011 at 5:09

GoogleCodeExporter commented 8 years ago
In the v10 branch?  Just grep for snprintf.

Original comment by dwhall...@gmail.com on 29 Nov 2011 at 2:02

GoogleCodeExporter commented 8 years ago
My work on #212 will resolve this issue, so I'm making this a duplicate.  I am 
making changes to the default branch and will duplicate the changes on the v10 
branch soon after.

Original comment by dwhall...@gmail.com on 1 Apr 2012 at 7:42