Branch: Tag:

2016-05-01

2016-05-01 11:05:33 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [auto]: Fixed multiple issues.

The PIKE_T_AUTO type node now always has a child type.

gc_check_type() now knows about PIKE_T_AUTO.

{debug_,}push_auto_typed_type() is no more.

Fixed issue with low_describe_type() appending to the wrong
buffer when describing the auto type.

Fixes some related type reference counting errors.

677: Inside #if defined(DEBUG_MALLOC)
   case T_INT:    case T_OBJECT:    break; -  case PIKE_T_AUTO: -  break; +        default:    Pike_fatal("mk_type(): Unhandled type-node: %d\n", type);
780:    push_object_type(flag, id);   }    - /* used while compiling to get the actual type of the auto type. */ - void debug_push_auto_typed_type( struct pike_type *aggregate ) - { -  copy_pike_type( *++Pike_compiler->type_stackp, -  mk_type(PIKE_T_AUTO, -  (void *)(ptrdiff_t)aggregate, -  NULL, -  0 ) ); -  - } -  +    void debug_push_scope_type(int level)   {    *Pike_compiler->type_stackp = mk_type(T_SCOPE,
942:    case T_NOT:    case T_TYPE:    case T_STRING: +  case PIKE_T_AUTO:    /* Make a new type of the top type, and put it in car. */    *Pike_compiler->type_stackp = mk_type(type,    *Pike_compiler->type_stackp, NULL,
963:    case T_MIXED:    case T_VOID:    case T_ZERO: -  case PIKE_T_AUTO: +     case PIKE_T_UNKNOWN:    /* Leaf type. */    *(++Pike_compiler->type_stackp) = mk_type(type, NULL, NULL, 0);
1027:    case T_TYPE:    case T_PROGRAM:    case T_STRING: +  case PIKE_T_AUTO:    /* car */    push_finished_type(top->car);    break;
1041:    case T_MIXED:    case T_VOID:    case T_ZERO: -  case PIKE_T_AUTO: +     case PIKE_T_UNKNOWN:    case '0':    case '1':
2254:    case T_VOID: fprintf(stderr, "void"); break;    case T_ZERO: fprintf(stderr, "zero"); break;    case T_MIXED: fprintf(stderr, "mixed"); break; -  case PIKE_T_AUTO: fprintf(stderr, "auto"); break; +  case PIKE_T_AUTO: +  fprintf(stderr, "auto"); +  if (s->car && (s->car->type != T_ZERO)) { +  fprintf(stderr, "("); +  simple_describe_type(s->car); +  fprintf(stderr, ")"); +  } +  break;    default:    fprintf(stderr, "Unknown type node: %d, %p:%p",    s->type, s->car, s->cdr);
2550:    }    break;    case PIKE_T_AUTO: -  my_strcat("auto"); +  if (t->car->type != T_ZERO) { +  string_builder_sprintf(s, "auto(%T)", t->car); +  } else { +  string_builder_strcat(s, "auto"); +  }    break;    default:    {
9091: Inside #if defined (PIKE_DEBUG) || defined (DO_PIKE_CLEANUP)
   case T_TYPE:    case T_PROGRAM:    case T_STRING: +  case PIKE_T_AUTO:    debug_gc_check (t->car, " as car in a type");    break;    case T_SCOPE: