mirror of
https://github.com/mirror/tinycc.git
synced 2026-08-30 11:57:51 +08:00
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:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user