aboutsummaryrefslogtreecommitdiff
path: root/tccgen.c
diff options
context:
space:
mode:
authorThomas Preud'homme <robotux@celest.fr>2013-09-20 22:49:49 +0200
committerThomas Preud'homme <robotux@celest.fr>2013-09-20 22:49:49 +0200
commit673befd2d7745a90c1c4fcb6d2f0e266c04f8c97 (patch)
tree8353bd7e07fc6975833a98818b8c96affddd82ab /tccgen.c
parent82969f045c99b4d1ef833de35117c17b326b46c0 (diff)
downloadtinycc-673befd2d7745a90c1c4fcb6d2f0e266c04f8c97.tar.gz
tinycc-673befd2d7745a90c1c4fcb6d2f0e266c04f8c97.tar.bz2
Report error when redefining enumerator
Prevent the following code from compiling: enum color {RED, GREEN, BLUE}; enum rgb {RED, G, B};
Diffstat (limited to 'tccgen.c')
-rw-r--r--tccgen.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tccgen.c b/tccgen.c
index 77ff87c..0f0aac5 100644
--- a/tccgen.c
+++ b/tccgen.c
@@ -2786,6 +2786,10 @@ static void struct_decl(CType *type, int u, int tdef)
v = tok;
if (v < TOK_UIDENT)
expect("identifier");
+ ss = sym_find(v);
+ if (ss)
+ tcc_error("redefinition of enumerator '%s'",
+ get_tok_str(v, NULL));
next();
if (tok == '=') {
next();