From d909dffcca9008c3615ca8b1d177d60459562812 Mon Sep 17 00:00:00 2001 From: zijunzhao Date: Wed, 7 Jun 2023 00:09:11 +0000 Subject: [PATCH] Nullability check for stdatomic module. Bugs: b/245972273 Test: adb shell Change-Id: I8d20606555f88b535259a589517f4c60b65f6761 --- libc/include/bits/stdatomic.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libc/include/bits/stdatomic.h b/libc/include/bits/stdatomic.h index 2ce6ee655..fe3d68d09 100644 --- a/libc/include/bits/stdatomic.h +++ b/libc/include/bits/stdatomic.h @@ -269,18 +269,18 @@ typedef struct { #define ATOMIC_FLAG_INIT { ATOMIC_VAR_INIT(false) } -static __inline bool atomic_flag_test_and_set_explicit(volatile atomic_flag *__object, memory_order __order) { +static __inline bool atomic_flag_test_and_set_explicit(volatile atomic_flag * _Nonnull __object, memory_order __order) { return (atomic_exchange_explicit(&__object->__flag, 1, __order)); } -static __inline void atomic_flag_clear_explicit(volatile atomic_flag *__object, memory_order __order) { +static __inline void atomic_flag_clear_explicit(volatile atomic_flag * _Nonnull __object, memory_order __order) { atomic_store_explicit(&__object->__flag, 0, __order); } -static __inline bool atomic_flag_test_and_set(volatile atomic_flag *__object) { +static __inline bool atomic_flag_test_and_set(volatile atomic_flag * _Nonnull __object) { return (atomic_flag_test_and_set_explicit(__object, memory_order_seq_cst)); } -static __inline void atomic_flag_clear(volatile atomic_flag *__object) { +static __inline void atomic_flag_clear(volatile atomic_flag * _Nonnull __object) { atomic_flag_clear_explicit(__object, memory_order_seq_cst); }