Allow strings in __builtin_constant_p

tccgen.c:
- Fix handling __builtin_constant_p

tests/bug.c:
- Remove tst3

tests/tcctest.c:
- Add new tests for __builtin_constant_p
This commit is contained in:
herman ten brugge
2020-09-17 09:11:10 +02:00
parent 4a16bebfab
commit c9bbd4e707
3 changed files with 6 additions and 9 deletions

View File

@@ -1,13 +1,6 @@
#include <stdio.h>
#include <stdarg.h>
void tst3(void)
{
/* Should VT_SYM be checked for TOK_builtin_constant_p */
int r = __builtin_constant_p("c");
if (r == 0) printf("%d\n",r);
}
int compile_errors(void)
{
#if TEST == 1
@@ -45,5 +38,4 @@ int compile_errors(void)
int
main(void)
{
tst3();
}

View File

@@ -3681,6 +3681,8 @@ void asm_test(void)
int constant_p_var;
int func(void);
void builtin_test(void)
{
short s;
@@ -3719,6 +3721,8 @@ void builtin_test(void)
#else
printf("res8 = %d\n", __builtin_constant_p(i && 0 ? i : 34));
#endif
printf("res9 = %d\n", __builtin_constant_p("hi"));
printf("res10 = %d\n", __builtin_constant_p(func()));
s = 1;
ll = 2;
i = __builtin_choose_expr (1 != 0, ll, s);