* support/packihx/configure.in,
[fw/sdcc] / src / SDCC.y
index 6d8229feb5f4fb8e6531aa5a43bb167fcbf8e40b..aae308d1e4db81a653b71fc7b79c9922d7565434 100644 (file)
@@ -95,7 +95,7 @@ bool uselessDecl = TRUE;
 %token CASE DEFAULT IF ELSE SWITCH WHILE DO FOR GOTO CONTINUE BREAK RETURN
 %token NAKED JAVANATIVE OVERLAY
 %token <yyinline> INLINEASM
-%token IFX ADDRESS_OF GET_VALUE_AT_ADDRESS SPIL UNSPIL GETHBIT
+%token IFX ADDRESS_OF GET_VALUE_AT_ADDRESS SPIL UNSPIL GETHBIT GETABIT GETBYTE GETWORD
 %token BITWISEAND UNARYMINUS IPUSH IPOP PCALL  ENDFUNCTION JUMPTABLE
 %token RRC RLC 
 %token CAST CALL PARAM NULLOP BLOCK LABEL RECEIVE SEND ARRAYINIT
@@ -186,9 +186,9 @@ function_attribute
    ;
 
 function_attributes
-   :  USING CONSTANT {
+   :  USING constant_expr {
                         $$ = newLink(SPECIFIER) ;
-                       FUNC_REGBANK($$) = (int) floatFromVal($2);
+                       FUNC_REGBANK($$) = (int) floatFromVal(constExprValue($2,TRUE));
                      }
    |  REENTRANT      {  $$ = newLink (SPECIFIER);
                        FUNC_ISREENT($$)=1;
@@ -578,8 +578,8 @@ storage_class_specifier
 
 Interrupt_storage
    : INTERRUPT { $$ = INTNO_UNSPEC ; }
-   | INTERRUPT CONSTANT
-        { int intno = (int) floatFromVal($2);
+   | INTERRUPT constant_expr
+        { int intno = (int) floatFromVal(constExprValue($2,TRUE));
           if ((intno >= 0) && (intno <= INTNO_MAX))
             $$ = intno;
           else
@@ -597,7 +597,7 @@ type_specifier
           /* add this to the storage class specifier  */
            SPEC_ABSA($1) = 1;   /* set the absolute addr flag */
            /* now get the abs addr from value */
-           SPEC_ADDR($1) = (int) floatFromVal(constExprValue($3,TRUE)) ;
+           SPEC_ADDR($1) = (unsigned) floatFromVal(constExprValue($3,TRUE)) ;
         }
    ;
 
@@ -909,9 +909,9 @@ struct_declarator_list
 struct_declarator
    : declarator 
    | ':' constant_expr  {
-                           int bitsize;
+                           unsigned int bitsize;
                            $$ = newSymbol (genSymName(NestLevel),NestLevel) ; 
-                           bitsize= (int) floatFromVal(constExprValue($2,TRUE));
+                           bitsize= (unsigned int) floatFromVal(constExprValue($2,TRUE));
                            if (bitsize > (port->s.int_size * 8)) {
                              bitsize = port->s.int_size * 8;
                              werror(E_BITFLD_SIZE, bitsize);
@@ -922,8 +922,8 @@ struct_declarator
                         }                        
    | declarator ':' constant_expr 
                         {
-                          int bitsize;
-                          bitsize= (int) floatFromVal(constExprValue($3,TRUE));
+                          unsigned int bitsize;
+                          bitsize= (unsigned int) floatFromVal(constExprValue($3,TRUE));
                           if (bitsize > (port->s.int_size * 8)) {
                             bitsize = port->s.int_size * 8;
                             werror(E_BITFLD_SIZE, bitsize);
@@ -1373,12 +1373,17 @@ abstract_declarator2
           
        FUNC_HASVARARGS(p) = IS_VARG($4);
        FUNC_ARGS(p) = reverseVal($4);
-            
+
        /* nest level was incremented to take care of the parms  */
        NestLevel-- ;
        currBlockno--;
-       p->next = $1;
-       $$ = p;
+       if (!$1) {
+         /* ((void (code *) (void)) 0) () */
+         $1=newLink(DECLARATOR);
+         DCL_TYPE($1)=CPOINTER;
+         $$ = $1;
+       }
+       $1->next=p;
 
        // remove the symbol args (if any)
        cleanUpLevel(SymbolTab,NestLevel+1);