pike.git / src / las.c

version» Context lines:

pike.git/src/las.c:380:    if (!match_types(n->type, t)) {    yytype_report(REPORT_ERROR, NULL, 0, t, NULL, 0, n->type, 0, msg);    return 0;    }    if (THIS_COMPILATION->lex.pragmas & ID_STRICT_TYPES) {    yytype_report(REPORT_WARNING, NULL, 0, t, NULL, 0, n->type, 0, msg);    }    if (runtime_options & RUNTIME_CHECK_TYPES) {    node *p = n->parent;    if (CAR(p) == n) { -  (_CAR(p) = mksoftcastnode(t, n))->parent = p; +  (_CAR(p) = mksoftcastnode(t, mkcastnode(mixed_type_string, n))) +  ->parent = p;    } else if (CDR(p) == n) { -  (_CDR(p) = mksoftcastnode(t, n))->parent = p; +  (_CDR(p) = mksoftcastnode(t, mkcastnode(mixed_type_string, n))) +  ->parent = p;    } else {    yywarning("Failed to find place to insert soft cast.");    }    }    return 1;   }      #undef BLOCK_ALLOC_NEXT   #define BLOCK_ALLOC_NEXT u.node.a      #undef PRE_INIT_BLOCK   #define PRE_INIT_BLOCK(NODE) do { \ -  NODE->token = USHRT_MAX; \ +  (NODE)->token = USHRT_MAX; \    } while (0)      BLOCK_ALLOC_FILL_PAGES(node_s, 2)    - #define NODES (sizeof (((struct node_s_block *) NULL)->x) / sizeof (struct node_s)) -  +    #undef BLOCK_ALLOC_NEXT   #define BLOCK_ALLOC_NEXT next      void free_all_nodes(void)   {    if(!Pike_compiler->previous)    {    node *tmp; -  struct node_s_block *tmp2; -  size_t e=0; +       #ifndef PIKE_DEBUG -  if(cumulative_parse_error) -  { +  if(cumulative_parse_error) { + #else +  size_t e=0, s=0; +  count_memory_in_node_ss(&e, &s); +  if(e) {   #endif -  -  for(tmp2=node_s_blocks;tmp2;tmp2=tmp2->next) e+=tmp2->used; -  if(e) -  { -  size_t e2=e; -  struct node_s_block *nextblk; -  for(tmp2=node_s_blocks;tmp2;tmp2=nextblk) -  { -  int n = tmp2->used; -  nextblk = tmp2->next; -  /* We want to be able to access the token field of all -  * the blocks... -  */ -  PIKE_MEM_RW(tmp2->x); -  for(e=0;n && e<NODES;e++) -  { -  if (tmp2->x[e].token != USHRT_MAX) -  { -  tmp=tmp2->x+e; +  WALK_NONFREE_BLOCKS(node_s, tmp, tmp->token != USHRT_MAX, {   #ifdef PIKE_DEBUG    if(!cumulative_parse_error)    {    fprintf(stderr,"Free node at %p, (%s:%ld) (token=%d).\n",    (void *)tmp,    tmp->current_file->str, (long)tmp->line_number,    tmp->token);       debug_malloc_dump_references(tmp,0,2,0);   
pike.git/src/las.c:466: Inside #if defined(PIKE_DEBUG)
  #ifdef PIKE_DEBUG    if (l_flag > 3) {    fprintf(stderr, "Freeing node that had %d refs.\n",    tmp->refs);    }   #endif /* PIKE_DEBUG */    /* Force the node to be freed. */    tmp->refs = 1;    debug_malloc_touch(tmp->type);    free_node(tmp); -  --n; +     } -  } -  } -  } +  });   #ifdef PIKE_DEBUG    if(!cumulative_parse_error) -  Pike_fatal("Failed to free %"PRINTSIZET"d nodes when compiling!\n",e2); - #endif +  Pike_fatal("Failed to free %"PRINTSIZET"d nodes when compiling!\n",e);    } - #ifndef PIKE_DEBUG + #else    }   #endif    free_all_node_s_blocks();    cumulative_parse_error=0;    }   }      void debug_free_node(node *n)   {    if(!n) return;
pike.git/src/las.c:1337:    free_string(t1);    return n;    }       if (n->type) {   #ifdef NEW_ARG_CHECK    if (!(result_type = soft_cast(type, n->type, 0))) {    ref_push_type_value(n->type);    ref_push_type_value(type);    yytype_report(REPORT_ERROR, -  NULL, 0, NULL, -  NULL, 0, NULL, +  NULL, 0, type, +  NULL, 0, n->type,    2, "Soft cast of %O to %O isn't a valid cast.");    } else if (result_type == n->type) {    ref_push_type_value(n->type);    ref_push_type_value(type);    yytype_report(REPORT_WARNING,    NULL, 0, NULL,    NULL, 0, NULL,    2, "Soft cast of %O to %O is a noop.");    }   #else /* !NEW_ARG_CHECK */
pike.git/src/las.c:3409: Inside #if defined(PIKE_DEBUG)
   fputs("Warning: Invalid assignment: ", stderr);    print_tree(n);    }   #endif /* PIKE_DEBUG */    yywarning("An expression of type %S cannot be assigned to "    "a variable of type %S.", t1, t2);    free_string(t2);    free_string(t1);    }    if (runtime_options & RUNTIME_CHECK_TYPES) { -  _CAR(n) = mksoftcastnode(CDR(n)->type, CAR(n)); +  _CAR(n) = mksoftcastnode(CDR(n)->type, +  mkcastnode(mixed_type_string, CAR(n)));    }    }    }   #endif /* 0 */    n->type = and_pike_types(CAR(n)->type, CDR(n)->type);    }    break;       case F_ARRAY_LVALUE:    {
pike.git/src/las.c:4263:    if (n->token == F_ARG_LIST) {    n->type = or_pike_types(CAR(n)->type, CDR(n)->type, 0);    } else {    copy_pike_type(n->type, CDR(n)->type);    }    break;       case F_MAGIC_INDEX:    /* FIXME: Could have a stricter type for ::`->(). */    /* FIXME: */ -  MAKE_CONSTANT_TYPE(n->type, tFunc(tMix tOr(tVoid,tInt),tMix)); +  MAKE_CONSTANT_TYPE(n->type, tFunc(tStr tOr3(tVoid,tObj,tDeprecated(tInt)) +  tOr(tVoid,tInt), tMix));    break;    case F_MAGIC_SET_INDEX:    /* FIXME: Could have a stricter type for ::`->=(). */    /* FIXME: */    MAKE_CONSTANT_TYPE(n->type, tFunc(tMix tSetvar(0,tMix) tOr(tVoid,tInt), tVar(0)));    break;    case F_MAGIC_INDICES:    MAKE_CONSTANT_TYPE(n->type, tFunc(tOr(tVoid,tInt), tArr(tString)));    break;    case F_MAGIC_VALUES:
pike.git/src/las.c:5218:    check_tree(n,0);    }   }      struct timer_oflo   {    INT32 counter;    int yes;   };    - static void check_evaluation_time(struct callback *cb,void *tmp,void *ignored) + static void check_evaluation_time(struct callback *UNUSED(cb), void *tmp, void *UNUSED(ignored))   {    struct timer_oflo *foo=(struct timer_oflo *)tmp;    if(foo->counter-- < 0)    {    foo->yes=1;    pike_throw();    }   }      ptrdiff_t eval_low(node *n,int print_error)