fix to allow build tcc by build-tcc.bat

move call to print_defines() from tcc.c to the libtcc.c
    define a print_defines() as a ST_FUNC
This commit is contained in:
seyko 2015-03-19 08:07:35 +03:00
parent aa812e8745
commit e2650608cd
4 changed files with 4 additions and 4 deletions

View file

@ -1338,6 +1338,8 @@ LIBTCCAPI int tcc_add_symbol(TCCState *s, const char *name, const void *val)
LIBTCCAPI int tcc_set_output_type(TCCState *s, int output_type) LIBTCCAPI int tcc_set_output_type(TCCState *s, int output_type)
{ {
s->output_type = output_type; s->output_type = output_type;
if (output_type == TCC_OUTPUT_PREPROCESS)
print_defines();
if (!s->nostdinc) { if (!s->nostdinc) {
/* default include paths */ /* default include paths */

2
tcc.c
View file

@ -309,8 +309,6 @@ int main(int argc, char **argv)
start_time = getclock_us(); start_time = getclock_us();
tcc_set_output_type(s, s->output_type); tcc_set_output_type(s, s->output_type);
if (s->output_type == TCC_OUTPUT_PREPROCESS)
print_defines();
/* compile or add each files or library */ /* compile or add each files or library */
for(i = ret = 0; i < s->nb_files && ret == 0; i++) { for(i = ret = 0; i < s->nb_files && ret == 0; i++) {

2
tcc.h
View file

@ -1160,7 +1160,7 @@ ST_INLN void define_push(int v, int macro_type, int *str, Sym *first_arg);
ST_FUNC void define_undef(Sym *s); ST_FUNC void define_undef(Sym *s);
ST_INLN Sym *define_find(int v); ST_INLN Sym *define_find(int v);
ST_FUNC void free_defines(Sym *b); ST_FUNC void free_defines(Sym *b);
void print_defines(void); ST_FUNC void print_defines(void);
ST_FUNC Sym *label_find(int v); ST_FUNC Sym *label_find(int v);
ST_FUNC Sym *label_push(Sym **ptop, int v, int flags); ST_FUNC Sym *label_push(Sym **ptop, int v, int flags);
ST_FUNC void label_pop(Sym **ptop, Sym *slast); ST_FUNC void label_pop(Sym **ptop, Sym *slast);

View file

@ -1155,7 +1155,7 @@ ST_FUNC void free_defines(Sym *b)
define_stack = b; define_stack = b;
} }
void print_defines(void) ST_FUNC void print_defines(void)
{ {
Sym *top, *s; Sym *top, *s;
int v; int v;