xref: /third_party/ltp/tools/sparse/sparse-src/validation/packed-bitfield3.c (revision f08c3bdf)
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/ltp/tools/sparse/sparse-src/validation/
1f08c3bdfSopenharmony_ci#define __packed __attribute__((packed))
2f08c3bdfSopenharmony_ci
3f08c3bdfSopenharmony_citypedef unsigned char   u8;
4f08c3bdfSopenharmony_citypedef __UINT16_TYPE__ u16;
5f08c3bdfSopenharmony_citypedef __UINT32_TYPE__ u32;
6f08c3bdfSopenharmony_citypedef __UINT64_TYPE__ u64;
7f08c3bdfSopenharmony_ci
8f08c3bdfSopenharmony_cistruct b {
9f08c3bdfSopenharmony_ci	u32	a:1;
10f08c3bdfSopenharmony_ci	u32	b:2;
11f08c3bdfSopenharmony_ci	u32	c:4;
12f08c3bdfSopenharmony_ci	u32	d:8;
13f08c3bdfSopenharmony_ci	u32	e:16;
14f08c3bdfSopenharmony_ci} __packed;
15f08c3bdfSopenharmony_ci_Static_assert(__alignof(struct b) == 1);
16f08c3bdfSopenharmony_ci_Static_assert(   sizeof(struct b) == 4);
17f08c3bdfSopenharmony_ci
18f08c3bdfSopenharmony_cistruct c {
19f08c3bdfSopenharmony_ci	u8	a;
20f08c3bdfSopenharmony_ci	u8	b;
21f08c3bdfSopenharmony_ci	u64	c:48;
22f08c3bdfSopenharmony_ci} __packed;
23f08c3bdfSopenharmony_ci_Static_assert(__alignof(struct c) == 1);
24f08c3bdfSopenharmony_ci_Static_assert(   sizeof(struct c) == 8);
25f08c3bdfSopenharmony_ci
26f08c3bdfSopenharmony_ci/*
27f08c3bdfSopenharmony_ci * check-name: packed-bitfield3
28f08c3bdfSopenharmony_ci */
29

Indexes created Thu Nov 07 10:32:03 CST 2024