History

Allow local redefinition of enumerator

Thomas Preud'homme committed 12 years ago

Commit 3e565841 parent a620b124 files · +17 −2Browse files

Unified · Split

4 files
  1. tccgen.c +1 −1
  2. tests/tests2/63_local_enumerator_redefinition.c +14 −0
  3. tests/tests2/63_local_enumerator_redefinition.expect +0 −0
  4. tests/tests2/Makefile +2 −1
tccgen.c+1−1
@@ -2827,7 +2827,7 @@ static void struct_decl(CType *type, int u, int tdef) · 2826 unmodified lines
2827 if (v < TOK_UIDENT)2827 if (v < TOK_UIDENT)
2828 expect("identifier");2828 expect("identifier");
2829 ss = sym_find(v);2829 ss = sym_find(v);
2830 if (ss)2830 if (ss && !local_stack)
2831 tcc_error("redefinition of enumerator '%s'",2831 tcc_error("redefinition of enumerator '%s'",
2832 get_tok_str(v, NULL));2832 get_tok_str(v, NULL));
2833 next();2833 next();
tests/tests2/63_local_enumerator_redefinition.c+14−0
@@ -0,0 +1,14 @@
1enum {
2 FOO,
3 BAR
4};
5
6int main(void)
7{
8 enum {
9 FOO = 2,
10 BAR
11 };
12
13 return BAR - FOO;
14}
tests/tests2/63_local_enumerator_redefinition.expect+0−0

Empty file added.

tests/tests2/Makefile+2−1
@@ -74,7 +74,8 @@ TESTS = \ · 73 unmodified lines
74 59_function_array.test \74 59_function_array.test \
75 60_enum_redefinition.test \75 60_enum_redefinition.test \
76 61_undefined_enum.test \76 61_undefined_enum.test \
77 62_enumerator_redefinition.test77 62_enumerator_redefinition.test \
78 63_local_enumerator_redefinition.test
78 79
79# 30_hanoi.test -- seg fault in the code, gcc as well80# 30_hanoi.test -- seg fault in the code, gcc as well
80# 34_array_assignment.test -- array assignment is not in C standard81# 34_array_assignment.test -- array assignment is not in C standard

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t