xref: /third_party/ltp/tools/sparse/sparse-src/validation/builtin-sync-cas.c
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/ltp/tools/sparse/sparse-src/validation/
1f08c3bdfSopenharmony_cistatic int *foo(int *ptr)
2f08c3bdfSopenharmony_ci{
3f08c3bdfSopenharmony_ci	__sync_val_compare_and_swap(ptr, 123, 0L);
4f08c3bdfSopenharmony_ci	return __sync_val_compare_and_swap(&ptr, ptr, ptr);
5f08c3bdfSopenharmony_ci}
6f08c3bdfSopenharmony_ci
7f08c3bdfSopenharmony_cistatic long bar(long *ptr)
8f08c3bdfSopenharmony_ci{
9f08c3bdfSopenharmony_ci	return __sync_val_compare_and_swap(ptr, ptr, 1);
10f08c3bdfSopenharmony_ci}
11f08c3bdfSopenharmony_ci
12f08c3bdfSopenharmony_cistatic _Bool boz(_Bool *ptr)
13f08c3bdfSopenharmony_ci{
14f08c3bdfSopenharmony_ci	return __sync_bool_compare_and_swap(ptr, 0, ptr);
15f08c3bdfSopenharmony_ci}
16f08c3bdfSopenharmony_ci
17f08c3bdfSopenharmony_ci/*
18f08c3bdfSopenharmony_ci * check-name: builtin-sync-cas
19f08c3bdfSopenharmony_ci *
20f08c3bdfSopenharmony_ci * check-error-start
21f08c3bdfSopenharmony_cibuiltin-sync-cas.c:9:49: warning: incorrect type in argument 2 (different base types)
22f08c3bdfSopenharmony_cibuiltin-sync-cas.c:9:49:    expected long
23f08c3bdfSopenharmony_cibuiltin-sync-cas.c:9:49:    got long *ptr
24f08c3bdfSopenharmony_ci * check-error-end
25f08c3bdfSopenharmony_ci */
26

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