diff options
author | Flavio Cruz <flaviocruz@gmail.com> | 2022-11-04 01:29:37 -0400 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2022-11-05 22:21:04 +0100 |
commit | 3902cb2fcae6e2028252b5d2016bf0e99ed74980 (patch) | |
tree | 6f48ad0f9567569680529367b843e6e8abbece90 /tests/includes/types.h | |
parent | 68b3d8fe3a9595b7a5cb2bb6bc5973ba26139704 (diff) |
Add support to define structures in mig.v1.8+git20221111
Basic syntax is presented below and allows users to define
nested structured types by using simpler or structure types as
members. Mig will use the C padding and alignment rules to produce
the same size as the corresponding C structures.
type timespec_t = struct {
uint32_t tv_sec;
uint32_t tv_nsec;
};
This allows us to build stubs that are more easily adaptable to other
architectures.
Message-Id: <Y2SjQSMOINY8I5Dy@viriathus>
Diffstat (limited to 'tests/includes/types.h')
-rw-r--r-- | tests/includes/types.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/includes/types.h b/tests/includes/types.h index fe70e69..2a70443 100644 --- a/tests/includes/types.h +++ b/tests/includes/types.h @@ -31,6 +31,26 @@ typedef struct char_struct { typedef char string_t[256]; typedef const char* const_string_t; +typedef struct simple_struct { + char a; +} simple_struct_t; + +typedef struct complex_struct_x { + simple_struct_t a; + simple_struct_t b; + int c; +} complex_struct_x_t; + +typedef struct complex_struct_y { + complex_struct_x_t a; + char b; +} complex_struct_y_t; + +typedef struct complex_struct_z { + complex_struct_y_t a; + int d; +} complex_struct_z_t; + static inline int8_t int_to_int8(int n) { return (int8_t) n; } |