diff options
| author | Thomas Preud'homme <robotux@celest.fr> | 2013-09-20 22:49:49 +0200 |
|---|---|---|
| committer | Thomas Preud'homme <robotux@celest.fr> | 2013-09-20 22:49:49 +0200 |
| commit | 673befd2d7745a90c1c4fcb6d2f0e266c04f8c97 (patch) | |
| tree | 8353bd7e07fc6975833a98818b8c96affddd82ab /tccgen.c | |
| parent | 82969f045c99b4d1ef833de35117c17b326b46c0 (diff) | |
| download | tinycc-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.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -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(); |
