tccgen.c: - Fix handling __builtin_constant_p tests/bug.c: - Remove tst3 tests/tcctest.c: - Add new tests for __builtin_constant_p
Showing the changes to tests (2 of 3 files). Show all
Unified · Split
| @@ -1,13 +1,6 @@ | ||
| 1 | 1 | #include <stdio.h> |
| 2 | 2 | #include <stdarg.h> |
| 3 | 3 | |
| 4 | −void tst3(void) | |
| 5 | −{ | |
| 6 | − /* Should VT_SYM be checked for TOK_builtin_constant_p */ | |
| 7 | − int r = __builtin_constant_p("c"); | |
| 8 | − if (r == 0) printf("%d\n",r); | |
| 9 | −} | |
| 10 | − | |
| 11 | 4 | int compile_errors(void) |
| 12 | 5 | { |
| 13 | 6 | #if TEST == 1 |
| @@ -45,5 +38,4 @@ int compile_errors(void) · 31 unmodified lines | ||
| 45 | 38 | int |
| 46 | 39 | main(void) |
| 47 | 40 | { |
| 48 | − tst3(); | |
| 49 | 41 | } |
| @@ -3681,6 +3681,8 @@ void asm_test(void) · 3680 unmodified lines | ||
| 3681 | 3681 | |
| 3682 | 3682 | int constant_p_var; |
| 3683 | 3683 | |
| 3684 | +int func(void); | |
| 3685 | + | |
| 3684 | 3686 | void builtin_test(void) |
| 3685 | 3687 | { |
| 3686 | 3688 | short s; |
| @@ -3719,6 +3721,8 @@ void builtin_test(void) · 32 unmodified lines | ||
| 3719 | 3721 | #else |
| 3720 | 3722 | printf("res8 = %d\n", __builtin_constant_p(i && 0 ? i : 34)); |
| 3721 | 3723 | #endif |
| 3724 | + printf("res9 = %d\n", __builtin_constant_p("hi")); | |
| 3725 | + printf("res10 = %d\n", __builtin_constant_p(func())); | |
| 3722 | 3726 | s = 1; |
| 3723 | 3727 | ll = 2; |
| 3724 | 3728 | i = __builtin_choose_expr (1 != 0, ll, s); |