Branch: Tag:

2020-10-18

2020-10-18 14:47:25 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Added some validation on PIKE_DEBUG.

match_types() now validates low_type_binop(AND, ...)
against low_match_types() when --with-rtldebug.

8445:      int match_types(struct pike_type *a, struct pike_type *b)   { +  struct pike_type *res; + #ifdef PIKE_DEBUG +  struct remap_state remap; +  struct mapping *markers; +  struct pike_type *tmp, *tmp2; +  +  memset(&remap, 0, sizeof(remap)); +  +  tmp = low_type_binop(PT_BINOP_AND, a, b, &remap, 0, 0, 0); +  +  markers = allocate_mapping(10); +  tmp2 = remap_markers(tmp, markers, NULL, PT_FLAG_REMAP_EVAL_MARKERS); + #endif +     clear_markers(); -  a = low_match_types(a, b, 0); -  free_type(a); -  return !!a; +  res = low_match_types(a, b, 0); +  free_type(res); +  + #ifdef PIKE_DEBUG +  if ((!!res) != (!!tmp2)) { +  fprintf(stderr, "match_types mismatch!\n" +  "a: "); +  simple_describe_type(a); +  fprintf(stderr, "\nb: "); +  simple_describe_type(b); +  fprintf(stderr, "\nres: "); +  simple_describe_type(res); +  fprintf(stderr, "\ntmp: "); +  simple_describe_type(tmp); +  fprintf(stderr, "\ntmp2: "); +  simple_describe_type(tmp2); +  fprintf(stderr, "\n\n");    }    -  +  free_type(tmp); +  free_type(tmp2); +  free_mapping(markers); + #endif +  +  return !!res; + } +    int pike_types_le(struct pike_type *a,struct pike_type *b)   {    clear_markers();