aboutsummaryrefslogtreecommitdiff
path: root/libtcc.c
diff options
context:
space:
mode:
authorgrischka <grischka>2017-07-09 12:07:40 +0200
committergrischka <grischka>2017-07-09 12:07:40 +0200
commit9f79b62ec4d84d07cf4a2fba969cb67c8f6ed8e5 (patch)
tree2ed2cab29b41d9b17c434d4a15565fb3e8387345 /libtcc.c
parent6c468c10f70d74e962591a0584765e42ce1bcaf2 (diff)
downloadtinycc-9f79b62ec4d84d07cf4a2fba969cb67c8f6ed8e5.tar.gz
tinycc-9f79b62ec4d84d07cf4a2fba969cb67c8f6ed8e5.tar.bz2
unsorted adjustments
- configure * use aarch64 instead of arm64 - Makefile * rename the custom include file to "config-extra.mak" * Also avoid "rm -r /*" if $(tccdir) is empty - pp/Makefile * fix .expect generation with gcc - tcc.h * cleanup #defines for _MSC_VER - tccgen.c: * fix const-propagation for &,| * fix anonymous named struct (ms-extension) and enable -fms-extension by default - i386-gen.c * clear VT_DEFSIGN - x86_64-gen.c/win64: * fix passing structs in registers * fix alloca (need to keep "func_scratch" below each alloca area on stack) (This allows to compile a working gnu-make on win64) - tccpp.c * alternative approach to 37999a4fbf3487b363fd0c2f9b7ab622401b202a This is to avoid some slowdown with ## token pasting. * get_tok_str() : return <eof> for TOK_EOF * -funsigned-char: apply to "string" literals as well - tccpe/tools.c: -impdef: support both 32 and 64 bit dlls anyway
Diffstat (limited to 'libtcc.c')
-rw-r--r--libtcc.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/libtcc.c b/libtcc.c
index ba50ddf..1adcca6 100644
--- a/libtcc.c
+++ b/libtcc.c
@@ -264,7 +264,7 @@ struct mem_debug_header {
int line_num;
char file_name[MEM_DEBUG_FILE_LEN + 1];
unsigned magic2;
- __attribute__((aligned(16))) unsigned magic3;
+ ALIGNED(16) unsigned magic3;
};
typedef struct mem_debug_header mem_debug_header_t;
@@ -581,10 +581,7 @@ ST_FUNC void tcc_open_bf(TCCState *s1, const char *filename, int initlen)
bf->buf_end = bf->buffer + initlen;
bf->buf_end[0] = CH_EOB; /* put eob symbol */
pstrcpy(bf->filename, sizeof(bf->filename), filename);
- pstrcpy(bf->filename2, sizeof(bf->filename2), filename);
-#ifdef _WIN32
- normalize_slashes(bf->filename);
-#endif
+ bf->true_filename = bf->filename;
bf->line_num = 1;
bf->ifdef_stack_ptr = s1->ifdef_stack_ptr;
bf->fd = -1;
@@ -599,6 +596,8 @@ ST_FUNC void tcc_close(void)
close(bf->fd);
total_lines += bf->line_num;
}
+ if (bf->true_filename != bf->filename)
+ tcc_free(bf->true_filename);
file = bf->prev;
tcc_free(bf);
}
@@ -615,8 +614,10 @@ ST_FUNC int tcc_open(TCCState *s1, const char *filename)
(int)(s1->include_stack_ptr - s1->include_stack), "", filename);
if (fd < 0)
return -1;
-
tcc_open_bf(s1, filename, 0);
+#ifdef _WIN32
+ normalize_slashes(file->filename);
+#endif
file->fd = fd;
return fd;
}
@@ -737,6 +738,7 @@ LIBTCCAPI TCCState *tcc_new(void)
s->alacarte_link = 1;
s->nocommon = 1;
s->warn_implicit_function_declaration = 1;
+ s->ms_extensions = 1;
#ifdef CHAR_IS_UNSIGNED
s->char_is_unsigned = 1;