Return to: e20c1eb99e
1: The new patch for the other machines still have the problem.
2: libcrt Rename (what if gcc had libcrt as well)
3: parse_number exact problem
4: VT_VLS is to allow tcc
Compile the following
int b = 9;
struct st {
int a;
int b [b]
};
struct st st1;
st1.b [8] = 9;
printf ("% d \ n", st1.b [8]);
tcc a problem. Due to problems in front, and now can not be improved
5: they commit much, bug difficult to lock, you can not let other people help develop.
6: ('\ t') too
Thanks to Michael and Ray
Their criticism I have benefited!
This commit is contained in:
@ -66,11 +66,11 @@ RUN_TCC = $(NATIVE_DEFINES) -DONE_SOURCE -run $(top_srcdir)/tcc.c $(TCCFLAGS)
|
||||
DISAS = objdump -d
|
||||
|
||||
# libtcc test
|
||||
ifdef LIBCRT
|
||||
LIBCRT:=$(TOP)/$(LIBCRT)
|
||||
ifdef LIBTCC1
|
||||
LIBTCC1:=$(TOP)/$(LIBTCC1)
|
||||
endif
|
||||
|
||||
all test : clean $(TESTS)
|
||||
all test : $(TESTS)
|
||||
|
||||
hello-exe: ../examples/ex1.c
|
||||
@echo ------------ $@ ------------
|
||||
@ -89,7 +89,7 @@ hello-run: ../examples/ex1.c
|
||||
@echo ------------ $@ ------------
|
||||
$(TCC) -run $<
|
||||
|
||||
libtest: libtcc_test$(EXESUF) $(LIBCRT)
|
||||
libtest: libtcc_test$(EXESUF) $(LIBTCC1)
|
||||
@echo ------------ $@ ------------
|
||||
./libtcc_test$(EXESUF) lib_path=..
|
||||
|
||||
@ -101,7 +101,7 @@ moretests:
|
||||
$(MAKE) -C tests2
|
||||
|
||||
w32-prep:
|
||||
cp ../libcrt.a ../lib
|
||||
cp ../libtcc1.a ../lib
|
||||
|
||||
# test.ref - generate using cc
|
||||
test.ref: tcctest.c
|
||||
@ -210,14 +210,10 @@ abitest-cc$(EXESUF): abitest.c $(top_builddir)/$(LIBTCC)
|
||||
abitest-tcc$(EXESUF): abitest.c libtcc.c
|
||||
$(TCC) -o $@ $^ $(CPPFLAGS) $(CFLAGS) $(NATIVE_DEFINES) -DONE_SOURCE $(LIBS) $(LDFLAGS) -I$(top_srcdir)
|
||||
|
||||
abitest-tcc1$(EXESUF): abitest.c $(top_builddir)/$(LIBTCC)
|
||||
$(CC) -o $@ $^ $(CPPFLAGS) $(CFLAGS) $(NATIVE_DEFINES) $(LIBS) $(LINK_LIBTCC) $(LDFLAGS) -I$(top_srcdir)
|
||||
|
||||
abitest: abitest-cc$(EXESUF) abitest-tcc$(EXESUF) abitest-tcc1$(EXESUF)
|
||||
abitest: abitest-cc$(EXESUF) abitest-tcc$(EXESUF)
|
||||
@echo ------------ $@ ------------
|
||||
./abitest-cc$(EXESUF) lib_path=.. include="$(top_srcdir)/include"
|
||||
./abitest-tcc$(EXESUF) lib_path=.. include="$(top_srcdir)/include"
|
||||
./abitest-tcc1$(EXESUF) lib_path=.. include="$(top_srcdir)/include"
|
||||
|
||||
vla_test$(EXESUF): vla_test.c
|
||||
$(TCC) -o $@ $^ $(CPPFLAGS) $(CFLAGS)
|
||||
@ -244,6 +240,6 @@ cache: tcc_g
|
||||
clean:
|
||||
$(MAKE) -C tests2 $@
|
||||
rm -vf *~ *.o *.a *.bin *.i *.ref *.out *.out? *.out?b *.cc \
|
||||
*-cc *-tcc *.exe *-tcc1\
|
||||
*-cc *-tcc *.exe \
|
||||
hello libtcc_test vla_test tcctest[1234] ex? tcc_g tcclib.h \
|
||||
../lib/libcrt.a
|
||||
../lib/libtcc1.a
|
||||
|
||||
@ -468,7 +468,7 @@ int main(int argc, char **argv) {
|
||||
const char *testname = NULL;
|
||||
int retval = EXIT_SUCCESS;
|
||||
|
||||
/* if tcclib.h and libcrt.a are not installed, where can we find them */
|
||||
/* if tcclib.h and libtcc1.a are not installed, where can we find them */
|
||||
for (i = 1; i < argc; ++i) {
|
||||
if (!memcmp(argv[i], "lib_path=",9))
|
||||
tccdir = argv[i] + 9;
|
||||
|
||||
@ -43,7 +43,7 @@ int main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* if tcclib.h and libcrt.a are not installed, where can we find them */
|
||||
/* if tcclib.h and libtcc1.a are not installed, where can we find them */
|
||||
if (argc == 2 && !memcmp(argv[1], "lib_path=",9))
|
||||
tcc_set_lib_path(s, argv[1]+9);
|
||||
|
||||
|
||||
@ -235,7 +235,7 @@ void intdiv_test(void)
|
||||
|
||||
void macro_test(void)
|
||||
{
|
||||
printf("macro:\n");
|
||||
printf("macro:\n");
|
||||
pf("N=%d\n", N);
|
||||
printf("aaa=%d\n", AAA);
|
||||
|
||||
@ -379,23 +379,6 @@ comment
|
||||
/* And again when the name and parenthes are separated by a
|
||||
comment. */
|
||||
TEST2 /* the comment */ ();
|
||||
/* macro_push and macro_pop test */
|
||||
#define MACRO_TEST "macro_test1\n"
|
||||
#pragma push_macro("MACRO_TEST")
|
||||
#undef MACRO_TEST
|
||||
#define MACRO_TEST "macro_test2\n"
|
||||
printf(MACRO_TEST);
|
||||
#pragma pop_macro("MACRO_TEST")
|
||||
printf(MACRO_TEST);
|
||||
/* gcc does not support
|
||||
#define MACRO_TEST_MACRO "MACRO_TEST"
|
||||
#pragma push_macro(MACRO_TEST_MACRO)
|
||||
#undef MACRO_TEST
|
||||
#define MACRO_TEST "macro_test3\n"
|
||||
printf(MACRO_TEST);
|
||||
#pragma pop_macro(MACRO_TEST_MACRO)
|
||||
printf(MACRO_TEST);
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@ -1697,6 +1680,7 @@ void prefix ## fcast(type a)\
|
||||
printf("ftof: %f %f %Lf\n", fa, da, la);\
|
||||
ia = (int)a;\
|
||||
llia = (long long)a;\
|
||||
a = (a >= 0) ? a : -a;\
|
||||
ua = (unsigned int)a;\
|
||||
llua = (unsigned long long)a;\
|
||||
printf("ftoi: %d %u %lld %llu\n", ia, ua, llia, llua);\
|
||||
@ -1726,18 +1710,6 @@ void prefix ## call(void)\
|
||||
printf("strto%s: %f\n", #prefix, (double)strto ## prefix("1.2", NULL));\
|
||||
}\
|
||||
\
|
||||
void prefix ## calc(type x, type y)\
|
||||
{\
|
||||
x=x*x;y=y*y;\
|
||||
printf("%d, %d\n", (int)x, (int)y);\
|
||||
x=x-y;y=y-x;\
|
||||
printf("%d, %d\n", (int)x, (int)y);\
|
||||
x=x/y;y=y/x;\
|
||||
printf("%d, %d\n", (int)x, (int)y);\
|
||||
x=x+x;y=y+y;\
|
||||
printf("%d, %d\n", (int)x, (int)y);\
|
||||
}\
|
||||
\
|
||||
void prefix ## signed_zeros(void) \
|
||||
{\
|
||||
type x = 0.0, y = -0.0, n, p;\
|
||||
@ -1760,7 +1732,7 @@ void prefix ## signed_zeros(void) \
|
||||
1.0 / x != 1.0 / p);\
|
||||
else\
|
||||
printf ("x != +y; this is wrong!\n");\
|
||||
p = -y;\
|
||||
p = -y;\
|
||||
if (x == p)\
|
||||
printf ("Test 1.0 / x != 1.0 / -y returns %d (should be 0).\n",\
|
||||
1.0 / x != 1.0 / p);\
|
||||
@ -1776,8 +1748,7 @@ void prefix ## test(void)\
|
||||
prefix ## fcast(234.6);\
|
||||
prefix ## fcast(-2334.6);\
|
||||
prefix ## call();\
|
||||
prefix ## calc(1, 1.0000000000000001);\
|
||||
prefix ## signed_zeros();\
|
||||
prefix ## signed_zeros();\
|
||||
}
|
||||
|
||||
FTEST(f, float, float, "%f")
|
||||
@ -2184,15 +2155,14 @@ void whitespace_test(void)
|
||||
{
|
||||
char *str;
|
||||
|
||||
|
||||
#if 1
|
||||
|
||||
#if 1
|
||||
ntf("whitspace:\n");
|
||||
pri\
|
||||
ntf("whitspace:\n");
|
||||
#endif
|
||||
pf("N=%d\n", 2);
|
||||
|
||||
pri\
|
||||
#ifdef CORRECT_CR_HANDLING
|
||||
pri\
|
||||
ntf("aaa=%d\n", 3);
|
||||
#endif
|
||||
@ -2204,12 +2174,11 @@ ntf("min=%d\n", 4);
|
||||
#ifdef ACCEPT_CR_IN_STRINGS
|
||||
printf("len1=%d\n", strlen("
|
||||
"));
|
||||
str = "
|
||||
#ifdef CORRECT_CR_HANDLING
|
||||
str = "
|
||||
";
|
||||
printf("len1=%d str[0]=%d\n", strlen(str), str[0]);
|
||||
printf("len1=%d\n", strlen("
|
||||
a
|
||||
#endif
|
||||
printf("len1=%d\n", strlen("
|
||||
a
|
||||
"));
|
||||
@ -2603,6 +2572,7 @@ int constant_p_var;
|
||||
|
||||
int constant_p_var;
|
||||
|
||||
void builtin_test(void)
|
||||
{
|
||||
#if GCC_MAJOR >= 3
|
||||
COMPAT_TYPE(int, int);
|
||||
@ -2612,9 +2582,9 @@ void builtin_test(void)
|
||||
COMPAT_TYPE(int, volatile int);
|
||||
COMPAT_TYPE(int *, int *);
|
||||
COMPAT_TYPE(int *, void *);
|
||||
COMPAT_TYPE(char, unsigned char);
|
||||
COMPAT_TYPE(int *, const int *);
|
||||
COMPAT_TYPE(char **, void *);
|
||||
COMPAT_TYPE(char *, unsigned char *);
|
||||
/* space is needed because tcc preprocessor introduces a space between each token */
|
||||
COMPAT_TYPE(char * *, void *);
|
||||
#endif
|
||||
printf("res = %d\n", __builtin_constant_p(1));
|
||||
|
||||
Reference in New Issue
Block a user