Revert all of my changes to directories & codingstyle.
This commit is contained in:
116
tests/tcctest.c
116
tests/tcctest.c
@ -320,7 +320,7 @@ void macro_test(void)
|
||||
#line 200
|
||||
printf("__LINE__=%d __FILE__=%s\n",
|
||||
__LINE__, __FILE__);
|
||||
#line 203 "test"
|
||||
#line 203 "test"
|
||||
printf("__LINE__=%d __FILE__=%s\n",
|
||||
__LINE__, __FILE__);
|
||||
#line 227 "tcctest.c"
|
||||
@ -348,7 +348,7 @@ void macro_test(void)
|
||||
glue(a <, <= 2);
|
||||
printf("a=%d\n", a);
|
||||
}
|
||||
|
||||
|
||||
/* macro function with argument outside the macro string */
|
||||
#define MF_s MF_hello
|
||||
#define MF_hello(msg) printf("%s\n",msg)
|
||||
@ -357,7 +357,7 @@ void macro_test(void)
|
||||
|
||||
MF_s("hi");
|
||||
MF_t("hi");
|
||||
|
||||
|
||||
/* test macro substituion inside args (should not eat stream) */
|
||||
printf("qq=%d\n", qq(qq)(2));
|
||||
|
||||
@ -398,7 +398,7 @@ void recursive_macro_test(void)
|
||||
printf("%d\n", ELFW(ST_INFO)(STB_WEAK, ELFW(ST_TYPE)(123)));
|
||||
|
||||
#define WRAP(x) x
|
||||
|
||||
|
||||
#define print_num(x) print_num(__FILE__,__LINE__,x)
|
||||
print_num(123);
|
||||
WRAP(print_num(123));
|
||||
@ -537,7 +537,7 @@ void goto_test()
|
||||
/* This needs to parse as label, not as start of decl. */
|
||||
typedef_and_label:
|
||||
s_loop:
|
||||
if (i >= 10)
|
||||
if (i >= 10)
|
||||
goto s_end;
|
||||
printf("%d", i);
|
||||
i++;
|
||||
@ -688,7 +688,7 @@ int main(int argc, char **argv)
|
||||
callsave_test();
|
||||
builtin_frame_address_test();
|
||||
intdiv_test();
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int tab[3];
|
||||
@ -797,10 +797,10 @@ void expr_test()
|
||||
printf("%d\n", ~12);
|
||||
printf("%d\n", -12);
|
||||
printf("%d\n", +12);
|
||||
printf("%d %d %d %d\n",
|
||||
isid('a'),
|
||||
isid('g'),
|
||||
isid('T'),
|
||||
printf("%d %d %d %d\n",
|
||||
isid('a'),
|
||||
isid('g'),
|
||||
isid('T'),
|
||||
isid('('));
|
||||
}
|
||||
|
||||
@ -984,7 +984,7 @@ void struct_test()
|
||||
sizeof(struct aligntest3), __alignof__(struct aligntest3));
|
||||
printf("aligntest4 sizeof=%d alignof=%d\n",
|
||||
sizeof(struct aligntest4), __alignof__(struct aligntest4));
|
||||
|
||||
|
||||
/* empty structures (GCC extension) */
|
||||
printf("sizeof(struct empty) = %d\n", sizeof(struct empty));
|
||||
printf("alignof(struct empty) = %d\n", __alignof__(struct empty));
|
||||
@ -999,17 +999,17 @@ void char_short_test()
|
||||
|
||||
var1 = 0x01020304;
|
||||
var2 = 0xfffefdfc;
|
||||
printf("s8=%d %d\n",
|
||||
printf("s8=%d %d\n",
|
||||
*(char *)&var1, *(char *)&var2);
|
||||
printf("u8=%d %d\n",
|
||||
printf("u8=%d %d\n",
|
||||
*(unsigned char *)&var1, *(unsigned char *)&var2);
|
||||
printf("s16=%d %d\n",
|
||||
printf("s16=%d %d\n",
|
||||
*(short *)&var1, *(short *)&var2);
|
||||
printf("u16=%d %d\n",
|
||||
printf("u16=%d %d\n",
|
||||
*(unsigned short *)&var1, *(unsigned short *)&var2);
|
||||
printf("s32=%d %d\n",
|
||||
printf("s32=%d %d\n",
|
||||
*(int *)&var1, *(int *)&var2);
|
||||
printf("u32=%d %d\n",
|
||||
printf("u32=%d %d\n",
|
||||
*(unsigned int *)&var1, *(unsigned int *)&var2);
|
||||
*(char *)&var1 = 0x08;
|
||||
printf("var1=%x\n", var1);
|
||||
@ -1099,7 +1099,7 @@ void bool_test()
|
||||
static int v1 = 34 ? : -1; /* constant case */
|
||||
static int v2 = 0 ? : -1; /* constant case */
|
||||
int a = 30;
|
||||
|
||||
|
||||
printf("%d %d\n", v1, v2);
|
||||
printf("%d %d\n", a - 30 ? : a * 2, a + 1 ? : a * 2);
|
||||
}
|
||||
@ -1116,8 +1116,8 @@ static int tab_reinit[];
|
||||
static int tab_reinit[10];
|
||||
|
||||
//int cinit1; /* a global variable can be defined several times without error ! */
|
||||
int cinit1;
|
||||
int cinit1;
|
||||
int cinit1;
|
||||
int cinit1;
|
||||
int cinit1 = 0;
|
||||
int *cinit2 = (int []){3, 2, 1};
|
||||
|
||||
@ -1157,7 +1157,7 @@ void compound_literal_test(void)
|
||||
|
||||
for(i=0;i<3;i++) {
|
||||
p = (int []){1, 2, 4 + i};
|
||||
printf("%d %d %d\n",
|
||||
printf("%d %d %d\n",
|
||||
p[0],
|
||||
p[1],
|
||||
p[2]);
|
||||
@ -1188,7 +1188,7 @@ kr_test()
|
||||
void num(int n)
|
||||
{
|
||||
char *tab, *p;
|
||||
tab = (char*)malloc(20);
|
||||
tab = (char*)malloc(20);
|
||||
p = tab;
|
||||
while (1) {
|
||||
*p = 48 + (n % 10);
|
||||
@ -1231,7 +1231,7 @@ void struct_assign_test(void)
|
||||
struct structa1 lsta1, lsta2;
|
||||
int i;
|
||||
} s, *ps;
|
||||
|
||||
|
||||
ps = &s;
|
||||
ps->i = 4;
|
||||
#if 0
|
||||
@ -1247,7 +1247,7 @@ void struct_assign_test(void)
|
||||
s.lsta2.f2 = 2;
|
||||
#endif
|
||||
struct_assign_test1(ps->lsta2, 3, 4.5);
|
||||
|
||||
|
||||
printf("before call: %d %d\n", s.lsta2.f1, s.lsta2.f2);
|
||||
ps->lsta2 = struct_assign_test2(ps->lsta2, ps->i);
|
||||
printf("after call: %d %d\n", ps->lsta2.f1, ps->lsta2.f2);
|
||||
@ -1300,9 +1300,9 @@ void cast_test()
|
||||
printf("%d\n", a);
|
||||
a = (scast = 65536) + 1;
|
||||
printf("%d\n", a);
|
||||
|
||||
|
||||
printf("sizeof(c) = %d, sizeof((int)c) = %d\n", sizeof(c), sizeof((int)c));
|
||||
|
||||
|
||||
/* test cast from unsigned to signed short to int */
|
||||
b = 0xf000;
|
||||
d = (short)b;
|
||||
@ -1310,7 +1310,7 @@ void cast_test()
|
||||
b = 0xf0f0;
|
||||
d = (char)b;
|
||||
printf("((unsigned)(char)0x%08x) = 0x%08x\n", b, d);
|
||||
|
||||
|
||||
/* test implicit int casting for array accesses */
|
||||
c = 0;
|
||||
tab[1] = 2;
|
||||
@ -1352,7 +1352,7 @@ char sinit8[] = "hello" "trala";
|
||||
|
||||
struct structinit1 sinit9 = { 1, 2, 3 };
|
||||
struct structinit1 sinit10 = { .f2 = 2, 3, .f1 = 1 };
|
||||
struct structinit1 sinit11 = { .f2 = 2, 3, .f1 = 1,
|
||||
struct structinit1 sinit11 = { .f2 = 2, 3, .f1 = 1,
|
||||
#ifdef ALL_ISOC99
|
||||
.farray[0] = 10,
|
||||
.farray[1] = 11,
|
||||
@ -1437,36 +1437,36 @@ void init_test(void)
|
||||
int linit15[10] = { linit1, linit1 + 1, [6] = linit1 + 2, };
|
||||
struct linit16 { int a1, a2, a3, a4; } linit16 = { 1, .a3 = 2 };
|
||||
int linit17 = sizeof(linit17);
|
||||
|
||||
|
||||
printf("init_test:\n");
|
||||
|
||||
printf("sinit1=%d\n", sinit1);
|
||||
printf("sinit2=%d\n", sinit2);
|
||||
printf("sinit3=%d %d %d %d\n",
|
||||
printf("sinit3=%d %d %d %d\n",
|
||||
sizeof(sinit3),
|
||||
sinit3[0],
|
||||
sinit3[1],
|
||||
sinit3[2]
|
||||
);
|
||||
printf("sinit6=%d\n", sizeof(sinit6));
|
||||
printf("sinit7=%d %d %d %d\n",
|
||||
printf("sinit7=%d %d %d %d\n",
|
||||
sizeof(sinit7),
|
||||
sinit7[0],
|
||||
sinit7[1],
|
||||
sinit7[2]
|
||||
);
|
||||
printf("sinit8=%s\n", sinit8);
|
||||
printf("sinit9=%d %d %d\n",
|
||||
printf("sinit9=%d %d %d\n",
|
||||
sinit9.f1,
|
||||
sinit9.f2,
|
||||
sinit9.f3
|
||||
);
|
||||
printf("sinit10=%d %d %d\n",
|
||||
printf("sinit10=%d %d %d\n",
|
||||
sinit10.f1,
|
||||
sinit10.f2,
|
||||
sinit10.f3
|
||||
);
|
||||
printf("sinit11=%d %d %d %d %d %d\n",
|
||||
printf("sinit11=%d %d %d %d %d %d\n",
|
||||
sinit11.f1,
|
||||
sinit11.f2,
|
||||
sinit11.f3,
|
||||
@ -1477,7 +1477,7 @@ void init_test(void)
|
||||
|
||||
for(i=0;i<3;i++)
|
||||
for(j=0;j<2;j++)
|
||||
printf("[%d][%d] = %d %d %d\n",
|
||||
printf("[%d][%d] = %d %d %d\n",
|
||||
i, j, sinit4[i][j], sinit5[i][j], linit4[i][j]);
|
||||
printf("linit1=%d\n", linit1);
|
||||
printf("linit2=%d\n", linit2);
|
||||
@ -1486,7 +1486,7 @@ void init_test(void)
|
||||
|
||||
printf("sinit12=%s\n", sinit12);
|
||||
printf("sinit13=%d %s %s %s\n",
|
||||
sizeof(sinit13),
|
||||
sizeof(sinit13),
|
||||
sinit13[0],
|
||||
sinit13[1],
|
||||
sinit13[2]);
|
||||
@ -1500,7 +1500,7 @@ void init_test(void)
|
||||
printf("\n");
|
||||
for(i=0;i<10;i++) printf(" %d", linit15[i]);
|
||||
printf("\n");
|
||||
printf("%d %d %d %d\n",
|
||||
printf("%d %d %d %d\n",
|
||||
linit16.a1,
|
||||
linit16.a2,
|
||||
linit16.a3,
|
||||
@ -1599,13 +1599,13 @@ void bitfield_test(void)
|
||||
printf("%d %d\n", sa, ca);
|
||||
|
||||
st1.f1 = 7;
|
||||
if (st1.f1 == -1)
|
||||
if (st1.f1 == -1)
|
||||
printf("st1.f1 == -1\n");
|
||||
else
|
||||
else
|
||||
printf("st1.f1 != -1\n");
|
||||
if (st1.f2 == -1)
|
||||
if (st1.f2 == -1)
|
||||
printf("st1.f2 == -1\n");
|
||||
else
|
||||
else
|
||||
printf("st1.f2 != -1\n");
|
||||
|
||||
/* bit sizes below must be bigger than 32 since GCC doesn't allow
|
||||
@ -1835,7 +1835,7 @@ void lloptest(long long a, long long b)
|
||||
a + b,
|
||||
a - b,
|
||||
a * b);
|
||||
|
||||
|
||||
if (b != 0) {
|
||||
printf("arith1: " LONG_LONG_FORMAT " " LONG_LONG_FORMAT "\n",
|
||||
a / b,
|
||||
@ -1856,7 +1856,7 @@ void lloptest(long long a, long long b)
|
||||
a > b,
|
||||
a >= b,
|
||||
a <= b);
|
||||
|
||||
|
||||
printf("utest: %d %d %d %d %d %d\n",
|
||||
ua == ub,
|
||||
ua != ub,
|
||||
@ -1932,7 +1932,7 @@ long long llfunc1(int a)
|
||||
}
|
||||
|
||||
struct S {
|
||||
int id;
|
||||
int id;
|
||||
char item;
|
||||
};
|
||||
|
||||
@ -1953,8 +1953,8 @@ void longlong_test(void)
|
||||
a = ia;
|
||||
b = ua;
|
||||
printf(LONG_LONG_FORMAT " " LONG_LONG_FORMAT "\n", a, b);
|
||||
printf(LONG_LONG_FORMAT " " LONG_LONG_FORMAT " " LONG_LONG_FORMAT " %Lx\n",
|
||||
(long long)1,
|
||||
printf(LONG_LONG_FORMAT " " LONG_LONG_FORMAT " " LONG_LONG_FORMAT " %Lx\n",
|
||||
(long long)1,
|
||||
(long long)-2,
|
||||
1LL,
|
||||
0x1234567812345679);
|
||||
@ -2049,7 +2049,7 @@ void vprintf1(const char *fmt, ...)
|
||||
|
||||
va_start(aq, fmt);
|
||||
va_copy(ap, aq);
|
||||
|
||||
|
||||
p = fmt;
|
||||
for(;;) {
|
||||
c = *p;
|
||||
@ -2250,10 +2250,10 @@ void c99_vla_test(int size1, int size2)
|
||||
#if defined __i386__ || defined __x86_64__
|
||||
int size = size1 * size2;
|
||||
int tab1[size][2], tab2[10][2];
|
||||
void *tab1_ptr, *tab2_ptr, *bad_ptr;
|
||||
void *tab1_ptr, *tab2_ptr, *bad_ptr;
|
||||
|
||||
/* "size" should have been 'captured' at tab1 declaration,
|
||||
so modifying it should have no effect on VLA behaviour. */
|
||||
so modifying it should have no effect on VLA behaviour. */
|
||||
size = size-1;
|
||||
|
||||
printf("Test C99 VLA 1 (sizeof): ");
|
||||
@ -2325,7 +2325,7 @@ void sizeof_test(void)
|
||||
uintptr_t t2;
|
||||
/* Effectively <<32, but defined also on 32bit machines. */
|
||||
t <<= 16;
|
||||
t <<= 16;
|
||||
t <<= 16;
|
||||
t++;
|
||||
/* This checks that sizeof really can be used to manipulate
|
||||
uintptr_t objects, without truncation. */
|
||||
@ -2358,15 +2358,15 @@ void statement_expr_test(void)
|
||||
{
|
||||
int a, i;
|
||||
|
||||
a = 0;
|
||||
for(i=0;i<10;i++) {
|
||||
a += 1 +
|
||||
( { int b, j;
|
||||
b = 0;
|
||||
a = 0;
|
||||
for(i=0;i<10;i++) {
|
||||
a += 1 +
|
||||
( { int b, j;
|
||||
b = 0;
|
||||
for(j=0;j<5;j++)
|
||||
b += j; b;
|
||||
} );
|
||||
}
|
||||
}
|
||||
printf("a=%d\n", a);
|
||||
|
||||
}
|
||||
@ -2589,7 +2589,7 @@ void builtin_test(void)
|
||||
COMPAT_TYPE(int *, const int *);
|
||||
COMPAT_TYPE(char *, unsigned char *);
|
||||
COMPAT_TYPE(char *, signed char *);
|
||||
COMPAT_TYPE(char *, char *);
|
||||
COMPAT_TYPE(char *, char *);
|
||||
/* space is needed because tcc preprocessor introduces a space between each token */
|
||||
COMPAT_TYPE(char * *, void *);
|
||||
#endif
|
||||
@ -2640,7 +2640,7 @@ void __attribute__((weak)) weak_test(void)
|
||||
printf("weak_v3=%d\n",&weak_v3 ? weak_v3 : 123);
|
||||
|
||||
printf("weak_fpa=%d\n",&weak_fpa ? weak_fpa() : 123);
|
||||
printf("weak_fpb=%d\n",&weak_fpb ? weak_fpb() : 123);
|
||||
printf("weak_fpb=%d\n",&weak_fpb ? weak_fpb() : 123);
|
||||
printf("weak_fpc=%d\n",&weak_fpc ? weak_fpc() : 123);
|
||||
|
||||
printf("weak_asm_f1=%d\n", weak_asm_f1 != NULL);
|
||||
|
||||
Reference in New Issue
Block a user