aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libtcc.c1
-rw-r--r--tcc.h1
-rw-r--r--tccgen.c12
3 files changed, 9 insertions, 5 deletions
diff --git a/libtcc.c b/libtcc.c
index 75a37c3..6db2236 100644
--- a/libtcc.c
+++ b/libtcc.c
@@ -1764,6 +1764,7 @@ static const FlagDef flag_defs[] = {
{ offsetof(TCCState, old_struct_init_code), 0, "old-struct-init-code" },
{ offsetof(TCCState, dollars_in_identifiers), 0, "dollars-in-identifiers" },
{ offsetof(TCCState, normalize_inc_dirs), 0, "normalize-inc-dirs" },
+ { offsetof(TCCState, no_type_redef_check), FD_INVERT, "type-redefinition-check" },
};
/* set/reset a flag */
diff --git a/tcc.h b/tcc.h
index 1698fb3..aec80b8 100644
--- a/tcc.h
+++ b/tcc.h
@@ -707,6 +707,7 @@ struct TCCState {
Liuux 2.4.26 can't find initrd when compiled with a new algorithm */
int dollars_in_identifiers; /* allows '$' char in indentifiers */
int normalize_inc_dirs; /* remove non-existent or duplicate directories from include paths */
+ int no_type_redef_check; /* no local vars redefinition check */
/* warning switches */
int warn_write_strings;
diff --git a/tccgen.c b/tccgen.c
index b9681df..898856c 100644
--- a/tccgen.c
+++ b/tccgen.c
@@ -166,11 +166,13 @@ ST_INLN void sym_free(Sym *sym)
ST_FUNC Sym *sym_push2(Sym **ps, int v, int t, long c)
{
Sym *s;
- if (ps == &local_stack) {
- for (s = *ps; s && s != scope_stack_bottom; s = s->prev)
- if (!(v & SYM_FIELD) && (v & ~SYM_STRUCT) < SYM_FIRST_ANOM && s->v == v)
- tcc_error("incompatible types for redefinition of '%s'",
- get_tok_str(v, NULL));
+ if (!tcc_state->no_type_redef_check) {
+ if (ps == &local_stack) {
+ for (s = *ps; s && s != scope_stack_bottom; s = s->prev)
+ if (!(v & SYM_FIELD) && (v & ~SYM_STRUCT) < SYM_FIRST_ANOM && s->v == v)
+ tcc_error("incompatible types for redefinition of '%s'",
+ get_tok_str(v, NULL));
+ }
}
s = sym_malloc();
s->asm_label = 0;