Unified · Split
| @@ -102,7 +102,10 @@ int isid(int c); · 101 unmodified lines | ||
| 102 | 102 | #define B3 4 |
| 103 | 103 | #endif |
| 104 | 104 | |
| 105 | −void macro_test() | |
| 105 | +#define __INT64_C(c) c ## LL | |
| 106 | +#define INT64_MIN (-__INT64_C(9223372036854775807)-1) | |
| 107 | + | |
| 108 | +void macro_test(void) | |
| 106 | 109 | { |
| 107 | 110 | printf("macro:\n"); |
| 108 | 111 | pf("N=%d\n", N); |
| @@ -189,7 +192,7 @@ void macro_test() · 80 unmodified lines | ||
| 189 | 192 | #line 203 "test" |
| 190 | 193 | printf("__LINE__=%d __FILE__=%s\n", |
| 191 | 194 | __LINE__, __FILE__); |
| 192 | −#line 185 "tcctest.c" | |
| 195 | +#line 195 "tcctest.c" | |
| 193 | 196 | |
| 194 | 197 | /* not strictly preprocessor, but we test it there */ |
| 195 | 198 | #ifdef C99_MACROS |
| @@ -202,6 +205,9 @@ void macro_test() · 6 unmodified lines | ||
| 202 | 205 | |
| 203 | 206 | /* gcc extension */ |
| 204 | 207 | printf("func='%s'\n", __FUNCTION__); |
| 208 | + | |
| 209 | + /* complicated macros in glibc */ | |
| 210 | + printf("INT64_MIN=%Ld\n", INT64_MIN); | |
| 205 | 211 | } |
| 206 | 212 | |
| 207 | 213 | int op(a,b) |
| @@ -1352,10 +1358,19 @@ void llfloat(void) · 1144 unmodified lines | ||
| 1352 | 1358 | |
| 1353 | 1359 | long long llfunc1(int a) |
| 1354 | 1360 | { |
| 1355 | − return a; | |
| 1361 | + return a * 2; | |
| 1362 | +} | |
| 1363 | + | |
| 1364 | +struct S { | |
| 1365 | + int id; | |
| 1366 | + char item; | |
| 1367 | +}; | |
| 1368 | + | |
| 1369 | +long long int value(struct S *v) | |
| 1370 | +{ | |
| 1371 | + return ((long long int)v->item); | |
| 1356 | 1372 | } |
| 1357 | 1373 | |
| 1358 | −/* currently not supported, except for typing */ | |
| 1359 | 1374 | void longlong_test(void) |
| 1360 | 1375 | { |
| 1361 | 1376 | long long a, b, c; |
| @@ -1382,7 +1397,7 @@ void longlong_test(void) · 20 unmodified lines | ||
| 1382 | 1397 | lloptest(-3, b); |
| 1383 | 1398 | llshift(0x123, 5); |
| 1384 | 1399 | llshift(-23, 5); |
| 1385 | − b = 0x72345678 << 10; | |
| 1400 | + b = 0x72345678LL << 10; | |
| 1386 | 1401 | llshift(b, 47); |
| 1387 | 1402 | |
| 1388 | 1403 | llfloat(); |
| @@ -1392,6 +1407,14 @@ void longlong_test(void) · 3 unmodified lines | ||
| 1392 | 1407 | c = a + b; |
| 1393 | 1408 | printf("%Lx\n", c); |
| 1394 | 1409 | #endif |
| 1410 | + | |
| 1411 | + /* long long reg spill test */ | |
| 1412 | + { | |
| 1413 | + struct S a; | |
| 1414 | + | |
| 1415 | + a.item = 3; | |
| 1416 | + printf("%lld\n", value(&a)); | |
| 1417 | + } | |
| 1395 | 1418 | } |
| 1396 | 1419 | |
| 1397 | 1420 | void vprintf1(const char *fmt, ...) |