From 7485787ebe99bc17498cbd2c748411f5c213e72a Mon Sep 17 00:00:00 2001 From: heck Date: Thu, 14 Jan 2021 17:38:15 +0100 Subject: [PATCH] lib_test - add anonymous enums --- examples/lib/lib_test/README.md | 18 ++++++++++++------ examples/lib/lib_test/enums.h | 16 +++++++++++++++- examples/lib/lib_test/typedefs.h | 5 +++++ 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/examples/lib/lib_test/README.md b/examples/lib/lib_test/README.md index 2a3cef2..d2059e2 100644 --- a/examples/lib/lib_test/README.md +++ b/examples/lib/lib_test/README.md @@ -1,11 +1,11 @@ pEpACIDgen test library ----------------------- This here is the test library for pEpACIDgen. -The C language is broken down into its components and common pattern. +The C language is broken down into its components and common patterns. It is a humble attempt to cover all possible combinations that can be created in the C language. (like, struct containing` primitive, struct containing struct, typedef chains, etc..). -Please note, that pointer types have not been addressed yet (at all) +Please note that pointer types have not been addressed yet (at all) The intended use of this test lib is: If you encounter a scenario using pEpACIDgen that poses problem @@ -46,7 +46,7 @@ define them when you are interested in the combination, and pEpACIDgen the defin Item Qualifier -=============== +============== V = Void already defined P = Primitive Type already defined S = Struct -> struct.h @@ -55,11 +55,12 @@ A = Alias -> structs.h/enums.h N = Nested (Structs only, cant be aliased) -> structs.h H = Hosting (Structs only -> structs.h containing the nested struct, cant be primitive) -T = typedef -> typedefs.h +T = Typedef -> typedefs.h I = Incomplete / (forward decl) -> struct.h/enums.h -func_ = function -> functions.h -var_ = variable -> vars.h +func_ = Function -> functions.h +var_ = Variable -> vars.h +U = Anonymous (enums onnly) -> enums.h prefixed underline (e.g _E) means no typedef/alias exists for this item (enum in this case) @@ -159,3 +160,8 @@ their respective "alias". Then a typedef os applied to every typedef (TT*) + + +# TODO: +* Pointers +* Unions diff --git a/examples/lib/lib_test/enums.h b/examples/lib/lib_test/enums.h index daa9fea..b5b7352 100644 --- a/examples/lib/lib_test/enums.h +++ b/examples/lib/lib_test/enums.h @@ -3,7 +3,7 @@ // Enums // ===== -// Enums only have the item qualifier I and A, +// Enums can be combined with the item qualifiers I, A and (only enums) X // so their combinations are simple. // // Covered combinations @@ -14,6 +14,8 @@ // _E = enum without an alias // E = enum // AE = alias of an enum +// _XE = anonymous enum without an alias +// AXE = alias of an anonymous enum // _IE = incomplete enum without anb alias @@ -38,5 +40,17 @@ typedef enum E { E2, } AE; +// _XE = anonymous enum +enum { + _XE1, + _XE2, + _XE3 +}; + +typedef enum { + AXE1, + AXE2, + AXE3 +} AXE; #endif //ENUMS_H diff --git a/examples/lib/lib_test/typedefs.h b/examples/lib/lib_test/typedefs.h index 6d35e08..e31f19a 100644 --- a/examples/lib/lib_test/typedefs.h +++ b/examples/lib/lib_test/typedefs.h @@ -90,6 +90,9 @@ typedef enum _E T_E; typedef enum E TE; // TAE = typedef of an alias of an enum typedef AE TAE; +// T_XE = anonymous without an alias is not a type, and cant be typedef'd +// TAXE = typedef of an anonymous enum +typedef AXE TAXE; // TT* = typedef of all typedefs above @@ -128,6 +131,8 @@ typedef TAIE TTAIE; typedef T_E TT_E; typedef TE TTE; typedef TAE TTAE; +typedef TAXE TTAXE; + #endif //TYPEDEFS_H