Alien-TinyCCx

 view release on metacpan or  search on metacpan

src/tests/exsymtab/10-symtab-compare-func-decl-and-def.c  view on Meta::CPAN


    Sym * def_arg2pt = def_arg2->type.ref;
    Sym * dec_arg2pt = dec_arg2->type.ref;
    is_i(dec_arg2pt->r, def_arg2pt->r, "arg2pt->r agree");
    is_i(dec_arg2pt->c, def_arg2pt->c, "arg2pt->c agree");
    is_i(dec_arg2pt->type.t, def_arg2pt->type.t, "arg2pt->type.t agree");

    /* Clean up */
    tcc_delete_extended_symbol_table(def_symtab);
    tcc_delete_extended_symbol_table(decl_symtab);

    return done_testing();
}

/* Original info:

Layout of definition function
Members of struct for foo:
  r is 230
  c is 2
  type.t is 6
Members for return type, i.e. foo->type.ref:
  ret->r is 1000
  ret->c is 1
  ret->type.t is 9 (floating point double should be 9)
Members for first argument, i.e. foo->type.ref->next:
  arg1->r is 0
  arg1->c is 0
  arg1->type.t is  is 0 (integer should be 0)
Members for second argument, i.e. foo->type.ref->next->next:
  arg2->r is 0
  arg2->c is 0
  arg2->type.t is 4 (pointer should be 4)
Members for second argument's pointer type, i.e. foo->type.ref->next->next->type.ref:
  arg2pt->r is 0
  arg2pt->c is ffffffff
  arg2pt->type.t is 9 (floating point double should be 9)

Layout of declaration function
Members of struct for foo:
  r is 230
  c is 0
  type.t is 86
Members for return type, i.e. foo->type.ref:
  ret->r is 11000
  ret->c is 1
  ret->type.t is 9 (floating point double should be 9)
Members for first argument, i.e. foo->type.ref->next:
  arg1->r is 0
  arg1->c is 0
  arg1->type.t is  is 0 (integer should be 0)
Members for second argument, i.e. foo->type.ref->next->next:
  arg2->r is 0
  arg2->c is 0
  arg2->type.t is 4 (pointer should be 4)
Members for second argument's pointer type, i.e. foo->type.ref->next->next->type.ref:
  arg2pt->r is 0
  arg2pt->c is ffffffff
  arg2pt->type.t is 9 (floating point double should be 9)

The c and type.t fields need to be updated. The difference with ret->r shows
that the declaration is a prototype, but the definition is not (see the
func_proto bit field of the AttributeDef struct in tcc.h.) Since I want to
make sure that later redefinitions get called out, I will keep this discrepancy
between the two. Note that I might want to update the weak field of the
AttributeDef...

*/



( run in 2.450 seconds using v1.01-cache-2.11-cpan-d7f47b0818f )