xref: /third_party/ltp/tools/sparse/sparse-src/validation/expand/compound-literal.c
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/ltp/tools/sparse/sparse-src/validation/expand/
1f08c3bdfSopenharmony_ci#define SAME_TYPE(A, B)	\
2f08c3bdfSopenharmony_ci	__builtin_types_compatible_p(A, B)
3f08c3bdfSopenharmony_ci
4f08c3bdfSopenharmony_cistruct s {
5f08c3bdfSopenharmony_ci	int i;
6f08c3bdfSopenharmony_ci};
7f08c3bdfSopenharmony_ci
8f08c3bdfSopenharmony_cistatic void foo(struct s *p)
9f08c3bdfSopenharmony_ci{
10f08c3bdfSopenharmony_ci	*p = (struct s) { .i = SAME_TYPE(int, int), };
11f08c3bdfSopenharmony_ci}
12f08c3bdfSopenharmony_ci
13f08c3bdfSopenharmony_ci/*
14f08c3bdfSopenharmony_ci * check-name: compound-literal
15f08c3bdfSopenharmony_ci * check-command: test-linearize $file
16f08c3bdfSopenharmony_ci *
17f08c3bdfSopenharmony_ci * check-output-start
18f08c3bdfSopenharmony_cifoo:
19f08c3bdfSopenharmony_ci.L0:
20f08c3bdfSopenharmony_ci	<entry-point>
21f08c3bdfSopenharmony_ci	store.32    $1 -> 0[%arg1]
22f08c3bdfSopenharmony_ci	ret
23f08c3bdfSopenharmony_ci
24f08c3bdfSopenharmony_ci
25f08c3bdfSopenharmony_ci * check-output-end
26f08c3bdfSopenharmony_ci */
27

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