Menu

#2858 {} might be required in SDCC.y

closed-accepted
None
Front-end
5
2019-01-27
2019-01-01
No

As can be seen from the discussion at

https://github.com/z88dk/z88dk/issues/971#issuecomment-450719040

there are some version sof bison out there that seem to require an extra {} in SDCC.y at thelast rule among these:

program
   : external_definition
   | program external_definition
   ;

external_definition
   : function_definition
        {
          // blockNo = 0;
        }
   | declaration
        {
          ignoreTypedefType = 0;
          if ($1 && $1->type && IS_FUNC($1->type))
            {
              /* The only legal storage classes for

               * a function prototype (declaration)
               * are extern and static. extern is the
               * default. Thus, if this function isn't
               * explicitly marked static, mark it
               * extern.
               */
              if ($1->etype && IS_SPEC($1->etype) && !SPEC_STAT($1->etype))
                {
                  SPEC_EXTR($1->etype) = 1;
                }
            }
          addSymChain (&$1);
          allocVariables ($1);
          cleanUpLevel (SymbolTab, 1);
        }
   | addressmod
   ;

I don't know why, and I never encountered one. It seems odd to only require it on the last, but not the first.
Still, the workaround seem to help some people, so I'd like to apply it befor 3.9.0. Though I'd much prefer to find out why it is needed (and if this is just a bug in some bison version).

Philipp

Discussion

  • Philipp Klaus Krause

    • summary: {} might be rewquired in SDCC.y --> {} might be required in SDCC.y
     
  • Philipp Klaus Krause

    • status: open --> closed-accepted
    • assigned_to: Philipp Klaus Krause
     
  • Philipp Klaus Krause

    Workaround applied a while ago, though I still have not idea why it would be needed.

    Philipp

     

Log in to post a comment.