* fixed GCC 4.4.0 mingw compilation:
[fw/sdcc] / src / SDCC.y
index 782d58325703212fae2be7d69fb9865805d1f405..fa165cef8a7241af3357d437e5b64218ae986435 100644 (file)
@@ -521,7 +521,7 @@ declaration_specifiers
        $$ = mergeSpec($1,$2, "type_specifier declaration_specifiers");
    }
    | function_specifier                             { $$ = $1; }
-   | function_specifier declaration_specifiers          { 
+   | function_specifier declaration_specifiers          {
      /* if the decl $2 is not a specifier */
      /* find the spec and replace it      */
      if ( !IS_SPEC($2)) {
@@ -709,7 +709,7 @@ type_specifier2
             symbol *sym;
             sym_link   *p  ;
             sym = findSym(TypedefTab,NULL,$1) ;
-            $$ = p = copyLinkChain(sym->type);
+            $$ = p = copyLinkChain(sym ? sym->type : NULL);
             SPEC_TYPEDEF(getSpec(p)) = 0;
             ignoreTypedefType = 1;
          }
@@ -926,6 +926,7 @@ struct_declarator
                            if (!bitsize)
                              bitsize = BITVAR_PAD;
                            $$->bitVar = bitsize;
+                           $$->bitUnnamed = 1;
                         }
    | declarator ':' constant_expr
                         {
@@ -1040,7 +1041,7 @@ opt_assign_expr
                                  $$ = cenum = constVal(lbuff);
                               }
                               else {
-                                 $$ = cenum = constVal("0");
+                                 $$ = cenum = constCharVal(0);
                               }
                            }
    ;
@@ -1203,7 +1204,7 @@ pointer
          }
    | unqualified_pointer type_specifier_list pointer
          {
-             $$ = $1 ;               
+             $$ = $1 ;
              if (IS_SPEC($2) && DCL_TYPE($3) == UPOINTER) {
                  DCL_PTR_CONST($1) = SPEC_CONST($2);
                  DCL_PTR_VOLATILE($1) = SPEC_VOLATILE($2);
@@ -1228,12 +1229,12 @@ pointer
                      DCL_TYPE($3) = EEPPOINTER;
                      break;
                  default:
-                   // this could be just "constant" 
+                   // this could be just "constant"
                    // werror(W_PTR_TYPE_INVALID);
                      ;
                  }
              }
-             else 
+             else
                  werror (W_PTR_TYPE_INVALID);
              $$->next = $3 ;
          }
@@ -1550,6 +1551,8 @@ selection_statement
                            {
                               noLineno++ ;
                               $$ = createIf ($3, $6, $7 );
+                              $$->lineno = $3->lineno;
+                              $$->filename = $3->filename;
                               noLineno--;
                            }
    | SWITCH '(' expr ')'   {
@@ -1630,7 +1633,8 @@ iteration_statement
                            noLineno++ ;
                            $$ = createWhile ( $1, STACK_POP(continueStack),
                                               STACK_POP(breakStack), $3, $6 );
-                           $$->lineno = $1->lineDef ;
+                           $$->lineno = $1->lineDef;
+                           $$->filename = $1->fileDef;
                            noLineno-- ;
                          }
    | do statement   WHILE '(' expr ')' ';'
@@ -1639,7 +1643,8 @@ iteration_statement
                           noLineno++ ;
                           $$ = createDo ( $1 , STACK_POP(continueStack),
                                           STACK_POP(breakStack), $5, $2);
-                          $$->lineno = $1->lineDef ;
+                          $$->lineno = $1->lineDef;
+                          $$->filename = $1->fileDef;
                           noLineno-- ;
                         }
    | for '(' expr_opt   ';' expr_opt ';' expr_opt ')'  statement