[ragel-users] Generating code for gcc 2.95
Eric Brown
yogieric at mac.com
Wed Feb 18 08:29:15 UTC 2009
I have a customer still deploying to rather old/stable systems that
run on gcc 2.95.
The only problem I'm noticing is that gcc 2.95 wants all variables
declared at the top of a scope. Ragel is generating something like
this: (which generates a syntax error when it sees const)
...
if ( _msg_eof_trans[cs] > 0 ) {
_trans = _msg_eof_trans[cs] - 1;
goto _eof_trans;
}
const char *__acts = _msg_actions + _msg_eof_actions[cs];
unsigned int __nacts = (unsigned int) *__acts++;
while ( __nacts-- > 0 ) {
switch ( *__acts++ ) {
case 12:
{ p--; {stack[top++] = cs; cs = 176; goto
_again;} }
break;
}
}
...
If I add one layer of scope, gcc 2.95 compiles properly:
if ( _msg_eof_trans[cs] > 0 ) {
_trans = _msg_eof_trans[cs] - 1;
goto _eof_trans;
}
{
const char *__acts = _msg_actions + _msg_eof_actions[cs];
unsigned int __nacts = (unsigned int) *__acts++;
while ( __nacts-- > 0 ) {
switch ( *__acts++ ) {
case 12:
{ p--; {stack[top++] = cs; cs = 176; goto
_again;} }
break;
}
}
}
I hate to manually hack the ragel output this way. If there's a ragel
or gcc option I'm missing, please let me know.
Got around this by using flat table-driven FSM (-F1). Still thought
the problems I was having were worth mentioning here.
Cheers,
Eric
More information about the ragel-users
mailing list