Allow 'make speedtest' in tests directory Fix compiler warning tccpp.c
Unified · Split
| @@ -1,6 +1,6 @@ | |||
| 1 | #include <tcclib.h> | 1 | #include <tcclib.h> |
| 2 | 2 | ||
| 3 | int fib(n) | 3 | int fib(int n) |
| 4 | { | 4 | { |
| 5 | if (n <= 2) | 5 | if (n <= 2) |
| 6 | return 1; | 6 | return 1; |
| @@ -18,6 +18,6 @@ int main(int argc, char **argv) · 11 unmodified lines | |||
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | n = atoi(argv[1]); | 20 | n = atoi(argv[1]); |
| 21 | printf("fib(%d) = %d\n", n, fib(n, 2)); | 21 | printf("fib(%d) = %d\n", n, fib(n)); |
| 22 | return 0; | 22 | return 0; |
| 23 | } | 23 | } |
| @@ -2575,12 +2575,13 @@ static void parse_number(const char *p) · 2574 unmodified lines | |||
| 2575 | if (t >= b) | 2575 | if (t >= b) |
| 2576 | tcc_error("invalid digit"); | 2576 | tcc_error("invalid digit"); |
| 2577 | n = n * b + t; | 2577 | n = n * b + t; |
| 2578 | if (!ov) | 2578 | if (!ov) { |
| 2579 | /* detect overflow */ | 2579 | /* detect overflow */ |
| 2580 | if (n1 >= 0x1000000000000000ULL && n / b != n1) | 2580 | if (n1 >= 0x1000000000000000ULL && n / b != n1) |
| 2581 | ov = 1; | 2581 | ov = 1; |
| 2582 | else | 2582 | else |
| 2583 | n1 = n; | 2583 | n1 = n; |
| 2584 | } | ||
| 2584 | } | 2585 | } |
| 2585 | #ifdef TCC_CUT_ON_INTEGER_LITERAL_OVERFLOW | 2586 | #ifdef TCC_CUT_ON_INTEGER_LITERAL_OVERFLOW |
| 2586 | /* On integer literal overflow use the most significant digits before | 2587 | /* On integer literal overflow use the most significant digits before |