Debian Codegraph @

crt/s2n/tests/features/S2N_ATOMIC_SUPPORTED.c

raw symbols SCIP
1 /*
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License").
5 * You may not use this file except in compliance with the License.
6 * A copy of the License is located at
7 *
8 * http://aws.amazon.com/apache2.0
9 *
10 * or in the "license" file accompanying this file. This file is distributed
11 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 * express or implied. See the License for the specific language governing
13 * permissions and limitations under the License.
14 */
15
16 #include <signal.h>
17 #include <stddef.h>
18
19 int main() {
20 /* Atomic builtins are supported by gcc 4.7.3 and later. */
21 sig_atomic_t atomic = 0, value = 1;
22 __atomic_store(&atomic, &value, __ATOMIC_RELAXED);
23 __atomic_load(&atomic, &value, __ATOMIC_RELAXED);
24
25 /* _Static_assert is supported for C99 by gcc 4.6 and later,
26 * so using it here shouldn't limit use of the atomic builtins. */
27 _Static_assert(__atomic_always_lock_free(sizeof(sig_atomic_t), NULL),
28 "Atomic operations in this environment would require locking");
29 return 0;
30 }