Debian Codegraph @

crt/s2n/tests/features/S2N_DIAGNOSTICS_PUSH_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 <stdint.h>
17
18 /* make sure we can call `_Pragma` in macros */
19 #define MACRO_CHECK \
20 do { \
21 _Pragma("GCC diagnostic push") \
22 _Pragma("GCC diagnostic ignored \"-Wsign-conversion\"") \
23 return -1; \
24 } while (0)
25
26 uint8_t unsigned_fun()
27 {
28 MACRO_CHECK;
29 }
30
31 int main()
32 {
33 const int value = 0;
34 const int *value_ptr = &value;
35
36 unsigned_fun();
37
38 /* make sure we can also push diagnostics via `#pragma` */
39 #pragma GCC diagnostic push
40 #pragma GCC diagnostic ignored "-Wcast-qual"
41 int *value_ptr_mut = (int*)value_ptr;
42
43 return *value_ptr_mut;
44 }