Files
tinycc/tests/tests2/35_sizeof.c
grischka 38ab5f65b3 tccgen: more of scope hacks
* case 1: local scope of 'ff'
  int main() {
    int ff = 123;
    {
      int ff(int):
      ff(456)
    }}

* case 2: linkage of a static extern symbol
  (older gcc did allow that)
  static int ff(int);
  int main() {
    int ff(int):
    ff(456)
  }

Also:
- cleanup enum, let sym_push() handle redefinition
- just mark incomplete array base types, unshare only
  when needed (in decl_initializer_alloc())
- fix sizeof empty array (= 0) : int ii[] = {};
- rename 'Sym' members used by __attribute__((cleanup(f)))
2025-09-08 17:23:18 +02:00

31 lines
658 B
C

int printf(const char*, ...);
int main()
{
char a;
short b;
printf("sizeof a : %d %d\n", sizeof(char), sizeof(a));
printf("sizeof b : %d %d\n", sizeof(short), sizeof(b));
int ii[] = {}; /* gnu extension, size = 0 */
printf("sizeof ii : %d\n", sizeof ii);
int kk[] = { 1 };
printf("sizeof kk : %d\n", sizeof kk);
char cc[] = "12";
printf("sizeof cc : %d\n", sizeof cc);
__WCHAR_TYPE__ ll[] = L"12345";
printf("len-of ll : %d\n", sizeof ll / sizeof ll[0]);
static struct {
int a,b,c;
int d[];
} ss[] = {{ 1, 2, 3, {} }};
printf("sizeof ss : %d\n", sizeof ss);
return 0;
}