-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make sentinel variant respect regular config
Like enum.prefix_with_name, or documentation style. Fixes #458
- Loading branch information
Showing
12 changed files
with
515 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#include <stdarg.h> | ||
#include <stdbool.h> | ||
#include <stdint.h> | ||
#include <stdlib.h> | ||
|
||
enum A { | ||
A_A1, | ||
A_A2, | ||
A_A3, | ||
/** | ||
* Must be last for serialization purposes | ||
*/ | ||
A_Sentinel, | ||
}; | ||
typedef uint8_t A; | ||
|
||
enum B { | ||
B_B1, | ||
B_B2, | ||
B_B3, | ||
/** | ||
* Must be last for serialization purposes | ||
*/ | ||
B_Sentinel, | ||
}; | ||
typedef uint8_t B; | ||
|
||
enum C_Tag { | ||
C_C1, | ||
C_C2, | ||
C_C3, | ||
/** | ||
* Must be last for serialization purposes | ||
*/ | ||
C_Sentinel, | ||
}; | ||
typedef uint8_t C_Tag; | ||
|
||
typedef struct C_C1_Body { | ||
C_Tag tag; | ||
uint32_t a; | ||
} C_C1_Body; | ||
|
||
typedef struct C_C2_Body { | ||
C_Tag tag; | ||
uint32_t b; | ||
} C_C2_Body; | ||
|
||
typedef union C { | ||
C_Tag tag; | ||
C_C1_Body c1; | ||
C_C2_Body c2; | ||
} C; | ||
|
||
void root(A a, B b, C c); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#include <stdarg.h> | ||
#include <stdbool.h> | ||
#include <stdint.h> | ||
#include <stdlib.h> | ||
|
||
enum A | ||
#ifdef __cplusplus | ||
: uint8_t | ||
#endif // __cplusplus | ||
{ | ||
A_A1, | ||
A_A2, | ||
A_A3, | ||
/** | ||
* Must be last for serialization purposes | ||
*/ | ||
A_Sentinel, | ||
}; | ||
#ifndef __cplusplus | ||
typedef uint8_t A; | ||
#endif // __cplusplus | ||
|
||
enum B | ||
#ifdef __cplusplus | ||
: uint8_t | ||
#endif // __cplusplus | ||
{ | ||
B_B1, | ||
B_B2, | ||
B_B3, | ||
/** | ||
* Must be last for serialization purposes | ||
*/ | ||
B_Sentinel, | ||
}; | ||
#ifndef __cplusplus | ||
typedef uint8_t B; | ||
#endif // __cplusplus | ||
|
||
enum C_Tag | ||
#ifdef __cplusplus | ||
: uint8_t | ||
#endif // __cplusplus | ||
{ | ||
C_C1, | ||
C_C2, | ||
C_C3, | ||
/** | ||
* Must be last for serialization purposes | ||
*/ | ||
C_Sentinel, | ||
}; | ||
#ifndef __cplusplus | ||
typedef uint8_t C_Tag; | ||
#endif // __cplusplus | ||
|
||
typedef struct C_C1_Body { | ||
C_Tag tag; | ||
uint32_t a; | ||
} C_C1_Body; | ||
|
||
typedef struct C_C2_Body { | ||
C_Tag tag; | ||
uint32_t b; | ||
} C_C2_Body; | ||
|
||
typedef union C { | ||
C_Tag tag; | ||
C_C1_Body c1; | ||
C_C2_Body c2; | ||
} C; | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif // __cplusplus | ||
|
||
void root(A a, B b, C c); | ||
|
||
#ifdef __cplusplus | ||
} // extern "C" | ||
#endif // __cplusplus |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#include <stdarg.h> | ||
#include <stdbool.h> | ||
#include <stdint.h> | ||
#include <stdlib.h> | ||
|
||
enum A { | ||
A_A1, | ||
A_A2, | ||
A_A3, | ||
/** | ||
* Must be last for serialization purposes | ||
*/ | ||
A_Sentinel, | ||
}; | ||
typedef uint8_t A; | ||
|
||
enum B { | ||
B_B1, | ||
B_B2, | ||
B_B3, | ||
/** | ||
* Must be last for serialization purposes | ||
*/ | ||
B_Sentinel, | ||
}; | ||
typedef uint8_t B; | ||
|
||
enum C_Tag { | ||
C_C1, | ||
C_C2, | ||
C_C3, | ||
/** | ||
* Must be last for serialization purposes | ||
*/ | ||
C_Sentinel, | ||
}; | ||
typedef uint8_t C_Tag; | ||
|
||
typedef struct { | ||
C_Tag tag; | ||
uint32_t a; | ||
} C_C1_Body; | ||
|
||
typedef struct { | ||
C_Tag tag; | ||
uint32_t b; | ||
} C_C2_Body; | ||
|
||
typedef union { | ||
C_Tag tag; | ||
C_C1_Body c1; | ||
C_C2_Body c2; | ||
} C; | ||
|
||
void root(A a, B b, C c); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#include <stdarg.h> | ||
#include <stdbool.h> | ||
#include <stdint.h> | ||
#include <stdlib.h> | ||
|
||
enum A | ||
#ifdef __cplusplus | ||
: uint8_t | ||
#endif // __cplusplus | ||
{ | ||
A_A1, | ||
A_A2, | ||
A_A3, | ||
/** | ||
* Must be last for serialization purposes | ||
*/ | ||
A_Sentinel, | ||
}; | ||
#ifndef __cplusplus | ||
typedef uint8_t A; | ||
#endif // __cplusplus | ||
|
||
enum B | ||
#ifdef __cplusplus | ||
: uint8_t | ||
#endif // __cplusplus | ||
{ | ||
B_B1, | ||
B_B2, | ||
B_B3, | ||
/** | ||
* Must be last for serialization purposes | ||
*/ | ||
B_Sentinel, | ||
}; | ||
#ifndef __cplusplus | ||
typedef uint8_t B; | ||
#endif // __cplusplus | ||
|
||
enum C_Tag | ||
#ifdef __cplusplus | ||
: uint8_t | ||
#endif // __cplusplus | ||
{ | ||
C_C1, | ||
C_C2, | ||
C_C3, | ||
/** | ||
* Must be last for serialization purposes | ||
*/ | ||
C_Sentinel, | ||
}; | ||
#ifndef __cplusplus | ||
typedef uint8_t C_Tag; | ||
#endif // __cplusplus | ||
|
||
typedef struct { | ||
C_Tag tag; | ||
uint32_t a; | ||
} C_C1_Body; | ||
|
||
typedef struct { | ||
C_Tag tag; | ||
uint32_t b; | ||
} C_C2_Body; | ||
|
||
typedef union { | ||
C_Tag tag; | ||
C_C1_Body c1; | ||
C_C2_Body c2; | ||
} C; | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif // __cplusplus | ||
|
||
void root(A a, B b, C c); | ||
|
||
#ifdef __cplusplus | ||
} // extern "C" | ||
#endif // __cplusplus |
Oops, something went wrong.