more long long tests - more ## tests

This commit is contained in:
bellard 2002-11-02 14:14:50 +00:00
parent 05a919e29f
commit 973eb60e01

View file

@ -102,7 +102,10 @@ int isid(int c);
#define B3 4 #define B3 4
#endif #endif
void macro_test() #define __INT64_C(c) c ## LL
#define INT64_MIN (-__INT64_C(9223372036854775807)-1)
void macro_test(void)
{ {
printf("macro:\n"); printf("macro:\n");
pf("N=%d\n", N); pf("N=%d\n", N);
@ -189,7 +192,7 @@ void macro_test()
#line 203 "test" #line 203 "test"
printf("__LINE__=%d __FILE__=%s\n", printf("__LINE__=%d __FILE__=%s\n",
__LINE__, __FILE__); __LINE__, __FILE__);
#line 185 "tcctest.c" #line 195 "tcctest.c"
/* not strictly preprocessor, but we test it there */ /* not strictly preprocessor, but we test it there */
#ifdef C99_MACROS #ifdef C99_MACROS
@ -202,6 +205,9 @@ void macro_test()
/* gcc extension */ /* gcc extension */
printf("func='%s'\n", __FUNCTION__); printf("func='%s'\n", __FUNCTION__);
/* complicated macros in glibc */
printf("INT64_MIN=%Ld\n", INT64_MIN);
} }
int op(a,b) int op(a,b)
@ -1352,10 +1358,19 @@ void llfloat(void)
long long llfunc1(int a) long long llfunc1(int a)
{ {
return a; return a * 2;
}
struct S {
int id;
char item;
};
long long int value(struct S *v)
{
return ((long long int)v->item);
} }
/* currently not supported, except for typing */
void longlong_test(void) void longlong_test(void)
{ {
long long a, b, c; long long a, b, c;
@ -1382,7 +1397,7 @@ void longlong_test(void)
lloptest(-3, b); lloptest(-3, b);
llshift(0x123, 5); llshift(0x123, 5);
llshift(-23, 5); llshift(-23, 5);
b = 0x72345678 << 10; b = 0x72345678LL << 10;
llshift(b, 47); llshift(b, 47);
llfloat(); llfloat();
@ -1392,6 +1407,14 @@ void longlong_test(void)
c = a + b; c = a + b;
printf("%Lx\n", c); printf("%Lx\n", c);
#endif #endif
/* long long reg spill test */
{
struct S a;
a.item = 3;
printf("%lld\n", value(&a));
}
} }
void vprintf1(const char *fmt, ...) void vprintf1(const char *fmt, ...)