[PATCH] Enable building 4.2.0 on non-gcc platforms

1 view
Skip to first unread message

Andy Dougherty

unread,
Mar 21, 2012, 12:18:35 PM3/21/12
to parro...@lists.parrot.org
Parrot-4.2.0 won't build on non-gcc platforms (unless the compiler is
unusually forgiving). The gcc-specific portion of pbc_to_exe was
changed, but the non-gcc portion wasn't changed to match. The following
change to pbc_to_exe fixes it, and removes a now-unnecessary cast.

diff -r -u parrot-4.2.0/tools/dev/pbc_to_exe.pir parrot-4.2.0-fixed/tools/dev/pbc_to_exe.pir
--- parrot-4.2.0/tools/dev/pbc_to_exe.pir 2012-03-18 13:35:11.000000000 -0400
+++ parrot-4.2.0-fixed/tools/dev/pbc_to_exe.pir 2012-03-21 12:05:19.000000000 -0400
@@ -90,7 +90,7 @@

initargs->gc_system = GCCORE;

- program_code_addr = (const unsigned char *)get_program_code();
+ program_code_addr = get_program_code();

if (!program_code_addr)
exit(EXIT_FAILURE);
@@ -434,7 +434,7 @@
print outfh, $S0
print outfh, ";\n"
print outfh, <<'END_OF_FUNCTION'
- const void * get_program_code(void)
+ const unsigned char * get_program_code(void)
{
return program_code;
}
@@ -627,7 +627,7 @@
print outfh, ";\n"

print outfh, <<'END_OF_FUNCTION'
- const void * get_program_code(void)
+ const unsigned char * get_program_code(void)
{
HRSRC hResource;
DWORD size;

--
Andy Dougherty doug...@lafayette.edu

_______________________________________________
http://lists.parrot.org/mailman/listinfo/parrot-dev

Jonathan "Duke" Leto

unread,
Mar 21, 2012, 2:15:45 PM3/21/12
to Andy Dougherty, parro...@lists.parrot.org
Howdy,

I am interested to know which compiler(s) this code failed on.

Currently we test with gcc, g++ and clang, but those are all gcc-ish.

This begs the question of revisiting which compilers we actually
*want* to support and which compilers we have the resources to
support.

Duke

--
Jonathan "Duke" Leto <jona...@leto.net>
Leto Labs LLC
209.691.DUKE // http://labs.leto.net
NOTE: Personal email is only checked twice a day at 10am/2pm PST,
please call/text for time-sensitive matters.
_______________________________________________
http://lists.parrot.org/mailman/listinfo/parrot-dev

Andy Lester

unread,
Mar 21, 2012, 2:20:16 PM3/21/12
to Jonathan "Duke" Leto, Andy Dougherty, parro...@lists.parrot.org

On Mar 21, 2012, at 1:15 PM, Jonathan Duke Leto wrote:

I am interested to know which compiler(s) this code failed on.

Currently we test with gcc, g++ and clang, but those are all gcc-ish.

g++ wasn't happy with the automatic cast of void* to unsigned char *.  I thought I'd fixed all those places where that was a problem, but apparently not.

xoa

Andy Dougherty

unread,
Mar 22, 2012, 9:07:18 AM3/22/12
to Jonathan "Duke" Leto, parro...@lists.parrot.org
On Wed, 21 Mar 2012, Jonathan "Duke" Leto wrote:

> Howdy,
>
> I am interested to know which compiler(s) this code failed on.
>
> Currently we test with gcc, g++ and clang, but those are all gcc-ish.

pbc_to_exe contains three independent code generators that must be
kept in sync:

'generate_code_gcc'(infile, outfh)
'generate_code_msvc'(infile, outfh)
'generate_code'(infile, outfh)

Which one to use is determed by sub 'determine_code_type', which keys off
config['gccversion']. Any compiler that doesn't set gccversion will run
into this problem. I encountered it with Sun's compiler, but MSVC was out
of sync too. I didn't test it, but changed it to match anyway.

Reply all
Reply to author
Forward
0 new messages