-
Notifications
You must be signed in to change notification settings - Fork 321
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initialize struct literal with list-initializer for C++11 standard (#401
) * Emit struct literal with list-initializer when language is Cxx * Update test results * Add test case - struct literal order * Memoize struct field names * Specify struct type at front of initializer
- Loading branch information
Showing
15 changed files
with
346 additions
and
55 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
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,24 @@ | ||
#include <stdarg.h> | ||
#include <stdbool.h> | ||
#include <stdint.h> | ||
#include <stdlib.h> | ||
|
||
typedef struct ABC { | ||
float a; | ||
uint32_t b; | ||
uint32_t c; | ||
} ABC; | ||
#define ABC_abc (ABC){ .a = 1.0, .b = 2, .c = 3 } | ||
#define ABC_bac (ABC){ .a = 1.0, .b = 2, .c = 3 } | ||
#define ABC_cba (ABC){ .a = 1.0, .b = 2, .c = 3 } | ||
|
||
typedef struct BAC { | ||
uint32_t b; | ||
float a; | ||
int32_t c; | ||
} BAC; | ||
#define BAC_abc (BAC){ .b = 1, .a = 2.0, .c = 3 } | ||
#define BAC_bac (BAC){ .b = 1, .a = 2.0, .c = 3 } | ||
#define BAC_cba (BAC){ .b = 1, .a = 2.0, .c = 3 } | ||
|
||
void root(ABC a1, BAC a2); |
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,32 @@ | ||
#include <stdarg.h> | ||
#include <stdbool.h> | ||
#include <stdint.h> | ||
#include <stdlib.h> | ||
|
||
typedef struct ABC { | ||
float a; | ||
uint32_t b; | ||
uint32_t c; | ||
} ABC; | ||
#define ABC_abc (ABC){ .a = 1.0, .b = 2, .c = 3 } | ||
#define ABC_bac (ABC){ .a = 1.0, .b = 2, .c = 3 } | ||
#define ABC_cba (ABC){ .a = 1.0, .b = 2, .c = 3 } | ||
|
||
typedef struct BAC { | ||
uint32_t b; | ||
float a; | ||
int32_t c; | ||
} BAC; | ||
#define BAC_abc (BAC){ .b = 1, .a = 2.0, .c = 3 } | ||
#define BAC_bac (BAC){ .b = 1, .a = 2.0, .c = 3 } | ||
#define BAC_cba (BAC){ .b = 1, .a = 2.0, .c = 3 } | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif // __cplusplus | ||
|
||
void root(ABC a1, BAC a2); | ||
|
||
#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
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
Oops, something went wrong.