| @@ -3720,8 +3720,9 @@ static void tcc_predefs(CString *cstr) · 3719 unmodified lines |
| 3720 | 3720 | , -1); |
| 3721 | 3721 | } |
| 3722 | 3722 | |
| 3723 | | −ST_FUNC void preprocess_start(TCCState *s1, int is_asm) |
| 3723 | +ST_FUNC void preprocess_start(TCCState *s1, int filetype) |
| 3724 | 3724 | { |
| 3725 | + int is_asm = !!(filetype & (AFF_TYPE_ASM|AFF_TYPE_ASMPP)); |
| 3725 | 3726 | CString cstr; |
| 3726 | 3727 | |
| 3727 | 3728 | tccpp_new(s1); |
| @@ -3739,23 +3740,25 @@ ST_FUNC void preprocess_start(TCCState *s1, int is_asm) · 11 unmodified lines |
| 3739 | 3740 | set_idnum('$', !is_asm && s1->dollars_in_identifiers ? IS_ID : 0); |
| 3740 | 3741 | set_idnum('.', is_asm ? IS_ID : 0); |
| 3741 | 3742 | |
| 3742 | | − cstr_new(&cstr); |
| 3743 | | − if (s1->cmdline_defs.size) |
| 3744 | | − cstr_cat(&cstr, s1->cmdline_defs.data, s1->cmdline_defs.size); |
| 3745 | | − cstr_printf(&cstr, "#define __BASE_FILE__ \"%s\"\n", file->filename); |
| 3746 | | − if (is_asm) |
| 3747 | | − cstr_printf(&cstr, "#define __ASSEMBLER__ 1\n"); |
| 3748 | | − if (s1->output_type == TCC_OUTPUT_MEMORY) |
| 3749 | | − cstr_printf(&cstr, "#define __TCC_RUN__ 1\n"); |
| 3750 | | − if (!is_asm && s1->output_type != TCC_OUTPUT_PREPROCESS) |
| 3751 | | − tcc_predefs(&cstr); |
| 3752 | | − if (s1->cmdline_incl.size) |
| 3753 | | − cstr_cat(&cstr, s1->cmdline_incl.data, s1->cmdline_incl.size); |
| 3754 | | − //printf("%s\n", (char*)cstr.data); |
| 3755 | | − *s1->include_stack_ptr++ = file; |
| 3756 | | − tcc_open_bf(s1, "<command line>", cstr.size); |
| 3757 | | − memcpy(file->buffer, cstr.data, cstr.size); |
| 3758 | | − cstr_free(&cstr); |
| 3743 | + if (!(filetype & AFF_TYPE_ASM)) { |
| 3744 | + cstr_new(&cstr); |
| 3745 | + if (s1->cmdline_defs.size) |
| 3746 | + cstr_cat(&cstr, s1->cmdline_defs.data, s1->cmdline_defs.size); |
| 3747 | + cstr_printf(&cstr, "#define __BASE_FILE__ \"%s\"\n", file->filename); |
| 3748 | + if (is_asm) |
| 3749 | + cstr_printf(&cstr, "#define __ASSEMBLER__ 1\n"); |
| 3750 | + if (s1->output_type == TCC_OUTPUT_MEMORY) |
| 3751 | + cstr_printf(&cstr, "#define __TCC_RUN__ 1\n"); |
| 3752 | + if (!is_asm && s1->output_type != TCC_OUTPUT_PREPROCESS) |
| 3753 | + tcc_predefs(&cstr); |
| 3754 | + if (s1->cmdline_incl.size) |
| 3755 | + cstr_cat(&cstr, s1->cmdline_incl.data, s1->cmdline_incl.size); |
| 3756 | + //printf("%s\n", (char*)cstr.data); |
| 3757 | + *s1->include_stack_ptr++ = file; |
| 3758 | + tcc_open_bf(s1, "<command line>", cstr.size); |
| 3759 | + memcpy(file->buffer, cstr.data, cstr.size); |
| 3760 | + cstr_free(&cstr); |
| 3761 | + } |
| 3759 | 3762 | |
| 3760 | 3763 | parse_flags = is_asm ? PARSE_FLAG_ASM_FILE : 0; |
| 3761 | 3764 | tok_flags = TOK_FLAG_BOL | TOK_FLAG_BOF; |