[ragel-users] Generating code for gcc 2.95

Adrian Thurston thurston at complang.org
Sat Feb 21 20:51:23 UTC 2009


Are you using an old version of Ragel? This shouldn't be happening with 
the latest. Also, could you tell me which options (if any) you're 
passing to Ragel.

-Adrian

Eric Brown wrote:
> 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
> 
> 
> _______________________________________________
> ragel-users mailing list
> ragel-users at complang.org
> http://www.complang.org/mailman/listinfo/ragel-users




More information about the ragel-users mailing list