On Thursday 17 May 2007 09:32:01 jerry gay wrote:
> this revision breaks parrot on msvc (and i suspect other c89-compliant
> compilers--sometimes i wonder if there are any others!)
I doubt even MSVC is C89-compliant, to be honest. It just barfs more often
than GCC on certain things.
> this situation is *extremely* frustrating. the temporary workaround is
> to revert this patch until it works everywhere. the solution is to
> find a way to make gcc (and other) compilers comply with our most
> important coding standard: C89 compliance.
Unfortunately, our headers (and even some system headers) don't follow C89:
$ make parrot
compilers/imcc/pbc.c
In file included from ./include/parrot/parrot.h:30,
from compilers/imcc/imc.h:21,
from compilers/imcc/pbc.c:7:
./include/parrot/config.h:82: warning: ISO C90 does not support ‘long long’
./include/parrot/config.h:83: warning: ISO C90 does not support ‘long long’
In file included from ./include/parrot/atomic.h:25,
from ./include/parrot/thread.h:20,
from ./include/parrot/pmc.h:19,
from ./include/parrot/parrot.h:282,
from compilers/imcc/imc.h:21,
from compilers/imcc/pbc.c:7:
./include/parrot/atomic/gcc_x86.h:30: error: expected ‘=’, ‘,’, ‘;’, ‘asm’
or ‘__attribute__’ before ‘static’
./include/parrot/atomic/gcc_x86.h:85: error: expected ‘=’, ‘,’, ‘;’, ‘asm’
or ‘__attribute__’ before ‘static
Chasing down that problem is... fun.
Regardless, does this patch fix the problem for you?
-- c
=== compilers/imcc/pbc.c
==================================================================
--- compilers/imcc/pbc.c (revision 3523)
+++ compilers/imcc/pbc.c (local)
@@ -595,7 +595,7 @@
* I think letting this override in PASM/PIR would be a
* can of worms - how do we call this if it declares .lex
*/
- decl_func = (decl_func_t) PMC_struct_val(decl_lex_meth);
+ decl_func = (decl_func_t) D2FPTR(PMC_struct_val(decl_lex_meth));
for (i = 0; i < hsh->size; i++) {
for (r = hsh->data[i]; r; r = r->next) {
@@ -641,14 +641,14 @@
static PMC*
find_outer(Interp *interp, IMC_Unit *unit)
{
- UNUSED(interp);
-
subs_t *s;
SymReg *sub;
size_t len;
PMC *current;
STRING *cur_name;
+ UNUSED(interp);
+
if (!unit->outer)
return NULL;
@@ -908,7 +908,7 @@
opcode_t size;
int key_length; /* P0["hi;there"; S0; 2] has length 3 */
int k;
- SymReg *r;
+ SymReg *r, *reg;
int var_type, slice_bits, type;
/* 0 is length */
@@ -918,7 +918,7 @@
char *s = s_key;
*s = 0;
- SymReg *reg = key_reg->set == 'K' ? key_reg->nextkey : key_reg;
+ reg = key_reg->set == 'K' ? key_reg->nextkey : key_reg;
for (key_length = 0; reg ; reg = reg->nextkey, key_length++) {
if ((pc - key - 2) >= KEYLEN)