xref: /third_party/ltp/tools/sparse/sparse-src/validation/struct-ns2.c (revision f08c3bdf)
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/ltp/tools/sparse/sparse-src/validation/
1f08c3bdfSopenharmony_cistatic void
2f08c3bdfSopenharmony_cig (struct Bar { int i; } *x)
3f08c3bdfSopenharmony_ci{
4f08c3bdfSopenharmony_ci  struct Bar y;
5f08c3bdfSopenharmony_ci  y.i = 1;
6f08c3bdfSopenharmony_ci}
7f08c3bdfSopenharmony_ci
8f08c3bdfSopenharmony_cistatic void
9f08c3bdfSopenharmony_cih (void)
10f08c3bdfSopenharmony_ci{
11f08c3bdfSopenharmony_ci  // This is not in scope and should barf loudly.
12f08c3bdfSopenharmony_ci  struct Bar y;
13f08c3bdfSopenharmony_ci  y.i = 1;
14f08c3bdfSopenharmony_ci}
15f08c3bdfSopenharmony_ci
16f08c3bdfSopenharmony_ci/*
17f08c3bdfSopenharmony_ci * check-name: struct not in scope
18f08c3bdfSopenharmony_ci * check-known-to-fail
19f08c3bdfSopenharmony_ci *
20f08c3bdfSopenharmony_ci * check-error-start
21f08c3bdfSopenharmony_cistruct-ns2.c:2:11: warning: bad scope for 'struct Bar'
22f08c3bdfSopenharmony_cistruct-ns2.c:12:14: error: incomplete type/unknown size for 'y'
23f08c3bdfSopenharmony_cistruct-ns2.c:13:5: error: using member 'i' in incomplete 'struct Bar'
24f08c3bdfSopenharmony_ci * check-error-end
25f08c3bdfSopenharmony_ci */
26

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