History

update

bellard committed 23 years ago

Commit a901c5f1 parent 2b64f2f1 file · +31 −0Browse files

Unified · Split

tcctest.c+31−0
@@ -76,6 +76,7 @@ void typeof_test(void); · 75 unmodified lines
76void local_label_test(void);76void local_label_test(void);
77void statement_expr_test(void);77void statement_expr_test(void);
78void asm_test(void);78void asm_test(void);
79void builtin_test(void);
79 80
80int fib(int n);81int fib(int n);
81void num(int n);82void num(int n);
@@ -498,6 +499,7 @@ int main(int argc, char **argv) · 416 unmodified lines
498 statement_expr_test();499 statement_expr_test();
499 local_label_test();500 local_label_test();
500 asm_test();501 asm_test();
502 builtin_test();
501 return 0; 503 return 0;
502}504}
503 505
@@ -1897,3 +1899,32 @@ void asm_test(void) · 1393 unmodified lines
1897}1899}
1898 1900
1899#endif1901#endif
1902
1903#define COMPAT_TYPE(type1, type2) \
1904{\
1905 printf("__builtin_types_compatible_p(%s, %s) = %d\n", #type1, #type2, \
1906 __builtin_types_compatible_p (type1, type2));\
1907}
1908
1909int constant_p_var;
1910
1911void builtin_test(void)
1912{
1913#if GCC_MAJOR >= 3
1914 COMPAT_TYPE(int, int);
1915 COMPAT_TYPE(int, unsigned int);
1916 COMPAT_TYPE(int, char);
1917 COMPAT_TYPE(int, const int);
1918 COMPAT_TYPE(int, volatile int);
1919 COMPAT_TYPE(int *, int *);
1920 COMPAT_TYPE(int *, void *);
1921 COMPAT_TYPE(int *, const int *);
1922 COMPAT_TYPE(char *, unsigned char *);
1923/* space is needed because tcc preprocessor introduces a space between each token */
1924 COMPAT_TYPE(char * *, void *);
1925#endif
1926 printf("res = %d\n", __builtin_constant_p(1));
1927 printf("res = %d\n", __builtin_constant_p(1 + 2));
1928 printf("res = %d\n", __builtin_constant_p(&constant_p_var));
1929 printf("res = %d\n", __builtin_constant_p(constant_p_var));
1930}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t