xref: /Universal-ctags/Units/parser-c.r/enum.c.d/input.c (revision 225fee7ea740012aa0fee2fc0db382c045257ce9)
1 enum E1 {
2     E1_member1 = 1,
3     E1_member2,
4     E1_member3
5 };
6 
7 enum {
8 	Anon1_member1
9 };
10 
11 enum E1 var1;
12 enum { Anon2_member1 } var2;
13 
14 // The following is valid only in C
function()15 enum { Anon3_member1 } function(){ return Anon3_member1; };
16 
17 // The following is accepted by gcc but it is also semantically flawed since the
18 // function definition cannot be present in the same compilation unit.
19 //
20 // enum { Anon4_member1 } function2();
21 //
22 // It's true that the definition for function2 *could* be in some other compilation
23 // unit and since the enum is technically an int, it might even work at linker level.
24 //
25 // However, it's ugly and complicates ctags parsing quite a lot.
26 // So for now I deliberately choose to not support it. If you find a piece of code
27 // that needs it, drop me a mail at <s dot stefanek at gmail dot com> :P
28 
29 enum E2 { E2_member1 } var3[10];
30 
31 
32 
33 
34