xref: /third_party/ltp/tools/sparse/sparse-src/validation/builtin-sync-fetch.c (revision f08c3bdf)
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/ltp/tools/sparse/sparse-src/validation/
1f08c3bdfSopenharmony_cistatic int ok_int(int *ptr, int val)
2f08c3bdfSopenharmony_ci{
3f08c3bdfSopenharmony_ci	return __sync_add_and_fetch(ptr, val);
4f08c3bdfSopenharmony_ci}
5f08c3bdfSopenharmony_ci
6f08c3bdfSopenharmony_cistatic long* ok_ptr(long **ptr, long *val)
7f08c3bdfSopenharmony_ci{
8f08c3bdfSopenharmony_ci	return __sync_add_and_fetch(ptr, val);
9f08c3bdfSopenharmony_ci}
10f08c3bdfSopenharmony_ci
11f08c3bdfSopenharmony_cistatic void chk_ret_ok(long *ptr, long val)
12f08c3bdfSopenharmony_ci{
13f08c3bdfSopenharmony_ci	_Static_assert([typeof(__sync_add_and_fetch(ptr, val))] == [long], "");
14f08c3bdfSopenharmony_ci}
15f08c3bdfSopenharmony_ci
16f08c3bdfSopenharmony_cistatic int chk_val(int *ptr, long val)
17f08c3bdfSopenharmony_ci{
18f08c3bdfSopenharmony_ci	// OK: val is converted to an int
19f08c3bdfSopenharmony_ci	return __sync_add_and_fetch(ptr, val);
20f08c3bdfSopenharmony_ci}
21f08c3bdfSopenharmony_ci
22f08c3bdfSopenharmony_ci/*
23f08c3bdfSopenharmony_ci * check-name: builtin-sync-fetch
24f08c3bdfSopenharmony_ci */
25

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