113498266Sopenharmony_ci/***************************************************************************
213498266Sopenharmony_ci *                                  _   _ ____  _
313498266Sopenharmony_ci *  Project                     ___| | | |  _ \| |
413498266Sopenharmony_ci *                             / __| | | | |_) | |
513498266Sopenharmony_ci *                            | (__| |_| |  _ <| |___
613498266Sopenharmony_ci *                             \___|\___/|_| \_\_____|
713498266Sopenharmony_ci *
813498266Sopenharmony_ci * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
913498266Sopenharmony_ci *
1013498266Sopenharmony_ci * This software is licensed as described in the file COPYING, which
1113498266Sopenharmony_ci * you should have received as part of this distribution. The terms
1213498266Sopenharmony_ci * are also available at https://curl.se/docs/copyright.html.
1313498266Sopenharmony_ci *
1413498266Sopenharmony_ci * You may opt to use, copy, modify, merge, publish, distribute and/or sell
1513498266Sopenharmony_ci * copies of the Software, and permit persons to whom the Software is
1613498266Sopenharmony_ci * furnished to do so, under the terms of the COPYING file.
1713498266Sopenharmony_ci *
1813498266Sopenharmony_ci * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
1913498266Sopenharmony_ci * KIND, either express or implied.
2013498266Sopenharmony_ci *
2113498266Sopenharmony_ci * SPDX-License-Identifier: curl
2213498266Sopenharmony_ci *
2313498266Sopenharmony_ci ***************************************************************************/
2413498266Sopenharmony_ci
2513498266Sopenharmony_ci#ifdef HAVE_FCNTL_O_NONBLOCK
2613498266Sopenharmony_ci/* headers for FCNTL_O_NONBLOCK test */
2713498266Sopenharmony_ci#include <sys/types.h>
2813498266Sopenharmony_ci#include <unistd.h>
2913498266Sopenharmony_ci#include <fcntl.h>
3013498266Sopenharmony_ci/* */
3113498266Sopenharmony_ci#if defined(sun) || defined(__sun__) || \
3213498266Sopenharmony_ci    defined(__SUNPRO_C) || defined(__SUNPRO_CC)
3313498266Sopenharmony_ci# if defined(__SVR4) || defined(__srv4__)
3413498266Sopenharmony_ci#  define PLATFORM_SOLARIS
3513498266Sopenharmony_ci# else
3613498266Sopenharmony_ci#  define PLATFORM_SUNOS4
3713498266Sopenharmony_ci# endif
3813498266Sopenharmony_ci#endif
3913498266Sopenharmony_ci#if (defined(_AIX) || defined(__xlC__)) && !defined(_AIX41)
4013498266Sopenharmony_ci# define PLATFORM_AIX_V3
4113498266Sopenharmony_ci#endif
4213498266Sopenharmony_ci/* */
4313498266Sopenharmony_ci#if defined(PLATFORM_SUNOS4) || defined(PLATFORM_AIX_V3)
4413498266Sopenharmony_ci#error "O_NONBLOCK does not work on this platform"
4513498266Sopenharmony_ci#endif
4613498266Sopenharmony_ci
4713498266Sopenharmony_ciint main(void)
4813498266Sopenharmony_ci{
4913498266Sopenharmony_ci  /* O_NONBLOCK source test */
5013498266Sopenharmony_ci  int flags = 0;
5113498266Sopenharmony_ci  if(0 != fcntl(0, F_SETFL, flags | O_NONBLOCK))
5213498266Sopenharmony_ci    return 1;
5313498266Sopenharmony_ci  return 0;
5413498266Sopenharmony_ci}
5513498266Sopenharmony_ci#endif
5613498266Sopenharmony_ci
5713498266Sopenharmony_ci/* tests for gethostbyname_r */
5813498266Sopenharmony_ci#if defined(HAVE_GETHOSTBYNAME_R_3_REENTRANT) || \
5913498266Sopenharmony_ci    defined(HAVE_GETHOSTBYNAME_R_5_REENTRANT) || \
6013498266Sopenharmony_ci    defined(HAVE_GETHOSTBYNAME_R_6_REENTRANT)
6113498266Sopenharmony_ci#   define _REENTRANT
6213498266Sopenharmony_ci    /* no idea whether _REENTRANT is always set, just invent a new flag */
6313498266Sopenharmony_ci#   define TEST_GETHOSTBYFOO_REENTRANT
6413498266Sopenharmony_ci#endif
6513498266Sopenharmony_ci#if defined(HAVE_GETHOSTBYNAME_R_3) || \
6613498266Sopenharmony_ci    defined(HAVE_GETHOSTBYNAME_R_5) || \
6713498266Sopenharmony_ci    defined(HAVE_GETHOSTBYNAME_R_6) || \
6813498266Sopenharmony_ci    defined(TEST_GETHOSTBYFOO_REENTRANT)
6913498266Sopenharmony_ci#include <sys/types.h>
7013498266Sopenharmony_ci#include <netdb.h>
7113498266Sopenharmony_ciint main(void)
7213498266Sopenharmony_ci{
7313498266Sopenharmony_ci  char *address = "example.com";
7413498266Sopenharmony_ci  int length = 0;
7513498266Sopenharmony_ci  int type = 0;
7613498266Sopenharmony_ci  struct hostent h;
7713498266Sopenharmony_ci  int rc = 0;
7813498266Sopenharmony_ci#if defined(HAVE_GETHOSTBYNAME_R_3) || \
7913498266Sopenharmony_ci    defined(HAVE_GETHOSTBYNAME_R_3_REENTRANT)
8013498266Sopenharmony_ci  struct hostent_data hdata;
8113498266Sopenharmony_ci#elif defined(HAVE_GETHOSTBYNAME_R_5) || \
8213498266Sopenharmony_ci      defined(HAVE_GETHOSTBYNAME_R_5_REENTRANT) || \
8313498266Sopenharmony_ci      defined(HAVE_GETHOSTBYNAME_R_6) || \
8413498266Sopenharmony_ci      defined(HAVE_GETHOSTBYNAME_R_6_REENTRANT)
8513498266Sopenharmony_ci  char buffer[8192];
8613498266Sopenharmony_ci  int h_errnop;
8713498266Sopenharmony_ci  struct hostent *hp;
8813498266Sopenharmony_ci#endif
8913498266Sopenharmony_ci
9013498266Sopenharmony_ci#if   defined(HAVE_GETHOSTBYNAME_R_3) || \
9113498266Sopenharmony_ci      defined(HAVE_GETHOSTBYNAME_R_3_REENTRANT)
9213498266Sopenharmony_ci  rc = gethostbyname_r(address, &h, &hdata);
9313498266Sopenharmony_ci#elif defined(HAVE_GETHOSTBYNAME_R_5) || \
9413498266Sopenharmony_ci      defined(HAVE_GETHOSTBYNAME_R_5_REENTRANT)
9513498266Sopenharmony_ci  rc = gethostbyname_r(address, &h, buffer, 8192, &h_errnop);
9613498266Sopenharmony_ci  (void)hp; /* not used for test */
9713498266Sopenharmony_ci#elif defined(HAVE_GETHOSTBYNAME_R_6) || \
9813498266Sopenharmony_ci      defined(HAVE_GETHOSTBYNAME_R_6_REENTRANT)
9913498266Sopenharmony_ci  rc = gethostbyname_r(address, &h, buffer, 8192, &hp, &h_errnop);
10013498266Sopenharmony_ci#endif
10113498266Sopenharmony_ci
10213498266Sopenharmony_ci  (void)length;
10313498266Sopenharmony_ci  (void)type;
10413498266Sopenharmony_ci  (void)rc;
10513498266Sopenharmony_ci  return 0;
10613498266Sopenharmony_ci}
10713498266Sopenharmony_ci#endif
10813498266Sopenharmony_ci
10913498266Sopenharmony_ci#ifdef HAVE_IN_ADDR_T
11013498266Sopenharmony_ci#include <sys/types.h>
11113498266Sopenharmony_ci#include <sys/socket.h>
11213498266Sopenharmony_ci#include <arpa/inet.h>
11313498266Sopenharmony_ciint main(void)
11413498266Sopenharmony_ci{
11513498266Sopenharmony_ci  if((in_addr_t *) 0)
11613498266Sopenharmony_ci    return 0;
11713498266Sopenharmony_ci  if(sizeof(in_addr_t))
11813498266Sopenharmony_ci    return 0;
11913498266Sopenharmony_ci  ;
12013498266Sopenharmony_ci  return 0;
12113498266Sopenharmony_ci}
12213498266Sopenharmony_ci#endif
12313498266Sopenharmony_ci
12413498266Sopenharmony_ci#ifdef HAVE_BOOL_T
12513498266Sopenharmony_ci#ifdef HAVE_SYS_TYPES_H
12613498266Sopenharmony_ci#include <sys/types.h>
12713498266Sopenharmony_ci#endif
12813498266Sopenharmony_ci#ifdef HAVE_STDBOOL_H
12913498266Sopenharmony_ci#include <stdbool.h>
13013498266Sopenharmony_ci#endif
13113498266Sopenharmony_ciint main(void)
13213498266Sopenharmony_ci{
13313498266Sopenharmony_ci  if(sizeof(bool *))
13413498266Sopenharmony_ci    return 0;
13513498266Sopenharmony_ci  ;
13613498266Sopenharmony_ci  return 0;
13713498266Sopenharmony_ci}
13813498266Sopenharmony_ci#endif
13913498266Sopenharmony_ci
14013498266Sopenharmony_ci#ifdef STDC_HEADERS
14113498266Sopenharmony_ci#include <stdlib.h>
14213498266Sopenharmony_ci#include <stdarg.h>
14313498266Sopenharmony_ci#include <string.h>
14413498266Sopenharmony_ci#include <float.h>
14513498266Sopenharmony_ciint main(void) { return 0; }
14613498266Sopenharmony_ci#endif
14713498266Sopenharmony_ci
14813498266Sopenharmony_ci#ifdef HAVE_FILE_OFFSET_BITS
14913498266Sopenharmony_ci#ifdef _FILE_OFFSET_BITS
15013498266Sopenharmony_ci#undef _FILE_OFFSET_BITS
15113498266Sopenharmony_ci#endif
15213498266Sopenharmony_ci#define _FILE_OFFSET_BITS 64
15313498266Sopenharmony_ci#include <sys/types.h>
15413498266Sopenharmony_ci /* Check that off_t can represent 2**63 - 1 correctly.
15513498266Sopenharmony_ci    We can't simply define LARGE_OFF_T to be 9223372036854775807,
15613498266Sopenharmony_ci    since some C++ compilers masquerading as C compilers
15713498266Sopenharmony_ci    incorrectly reject 9223372036854775807.  */
15813498266Sopenharmony_ci#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
15913498266Sopenharmony_ci  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
16013498266Sopenharmony_ci                       && LARGE_OFF_T % 2147483647 == 1)
16113498266Sopenharmony_ci                      ? 1 : -1];
16213498266Sopenharmony_ciint main(void) { ; return 0; }
16313498266Sopenharmony_ci#endif
16413498266Sopenharmony_ci
16513498266Sopenharmony_ci#ifdef HAVE_IOCTLSOCKET
16613498266Sopenharmony_ci/* includes start */
16713498266Sopenharmony_ci#ifdef _WIN32
16813498266Sopenharmony_ci#  ifndef WIN32_LEAN_AND_MEAN
16913498266Sopenharmony_ci#    define WIN32_LEAN_AND_MEAN
17013498266Sopenharmony_ci#  endif
17113498266Sopenharmony_ci#  include <winsock2.h>
17213498266Sopenharmony_ci#endif
17313498266Sopenharmony_ciint main(void)
17413498266Sopenharmony_ci{
17513498266Sopenharmony_ci  /* ioctlsocket source code */
17613498266Sopenharmony_ci  int socket;
17713498266Sopenharmony_ci  unsigned long flags = ioctlsocket(socket, FIONBIO, &flags);
17813498266Sopenharmony_ci  ;
17913498266Sopenharmony_ci  return 0;
18013498266Sopenharmony_ci}
18113498266Sopenharmony_ci
18213498266Sopenharmony_ci#endif
18313498266Sopenharmony_ci
18413498266Sopenharmony_ci#ifdef HAVE_IOCTLSOCKET_CAMEL
18513498266Sopenharmony_ci/* includes start */
18613498266Sopenharmony_ci#ifdef _WIN32
18713498266Sopenharmony_ci#  ifndef WIN32_LEAN_AND_MEAN
18813498266Sopenharmony_ci#    define WIN32_LEAN_AND_MEAN
18913498266Sopenharmony_ci#  endif
19013498266Sopenharmony_ci#  include <winsock2.h>
19113498266Sopenharmony_ci#endif
19213498266Sopenharmony_ciint main(void)
19313498266Sopenharmony_ci{
19413498266Sopenharmony_ci  /* IoctlSocket source code */
19513498266Sopenharmony_ci  if(0 != IoctlSocket(0, 0, 0))
19613498266Sopenharmony_ci    return 1;
19713498266Sopenharmony_ci  ;
19813498266Sopenharmony_ci  return 0;
19913498266Sopenharmony_ci}
20013498266Sopenharmony_ci#endif
20113498266Sopenharmony_ci
20213498266Sopenharmony_ci#ifdef HAVE_IOCTLSOCKET_CAMEL_FIONBIO
20313498266Sopenharmony_ci/* includes start */
20413498266Sopenharmony_ci#ifdef _WIN32
20513498266Sopenharmony_ci#  ifndef WIN32_LEAN_AND_MEAN
20613498266Sopenharmony_ci#    define WIN32_LEAN_AND_MEAN
20713498266Sopenharmony_ci#  endif
20813498266Sopenharmony_ci#  include <winsock2.h>
20913498266Sopenharmony_ci#endif
21013498266Sopenharmony_ciint main(void)
21113498266Sopenharmony_ci{
21213498266Sopenharmony_ci  /* IoctlSocket source code */
21313498266Sopenharmony_ci  long flags = 0;
21413498266Sopenharmony_ci  if(0 != IoctlSocket(0, FIONBIO, &flags))
21513498266Sopenharmony_ci    return 1;
21613498266Sopenharmony_ci  ;
21713498266Sopenharmony_ci  return 0;
21813498266Sopenharmony_ci}
21913498266Sopenharmony_ci#endif
22013498266Sopenharmony_ci
22113498266Sopenharmony_ci#ifdef HAVE_IOCTLSOCKET_FIONBIO
22213498266Sopenharmony_ci/* includes start */
22313498266Sopenharmony_ci#ifdef _WIN32
22413498266Sopenharmony_ci#  ifndef WIN32_LEAN_AND_MEAN
22513498266Sopenharmony_ci#    define WIN32_LEAN_AND_MEAN
22613498266Sopenharmony_ci#  endif
22713498266Sopenharmony_ci#  include <winsock2.h>
22813498266Sopenharmony_ci#endif
22913498266Sopenharmony_ciint main(void)
23013498266Sopenharmony_ci{
23113498266Sopenharmony_ci  int flags = 0;
23213498266Sopenharmony_ci  if(0 != ioctlsocket(0, FIONBIO, &flags))
23313498266Sopenharmony_ci    return 1;
23413498266Sopenharmony_ci  ;
23513498266Sopenharmony_ci  return 0;
23613498266Sopenharmony_ci}
23713498266Sopenharmony_ci#endif
23813498266Sopenharmony_ci
23913498266Sopenharmony_ci#ifdef HAVE_IOCTL_FIONBIO
24013498266Sopenharmony_ci/* headers for FIONBIO test */
24113498266Sopenharmony_ci/* includes start */
24213498266Sopenharmony_ci#ifdef HAVE_SYS_TYPES_H
24313498266Sopenharmony_ci#  include <sys/types.h>
24413498266Sopenharmony_ci#endif
24513498266Sopenharmony_ci#ifdef HAVE_UNISTD_H
24613498266Sopenharmony_ci#  include <unistd.h>
24713498266Sopenharmony_ci#endif
24813498266Sopenharmony_ci#ifdef HAVE_SYS_SOCKET_H
24913498266Sopenharmony_ci#  include <sys/socket.h>
25013498266Sopenharmony_ci#endif
25113498266Sopenharmony_ci#ifdef HAVE_SYS_IOCTL_H
25213498266Sopenharmony_ci#  include <sys/ioctl.h>
25313498266Sopenharmony_ci#endif
25413498266Sopenharmony_ci#ifdef HAVE_STROPTS_H
25513498266Sopenharmony_ci#  include <stropts.h>
25613498266Sopenharmony_ci#endif
25713498266Sopenharmony_ciint main(void)
25813498266Sopenharmony_ci{
25913498266Sopenharmony_ci  int flags = 0;
26013498266Sopenharmony_ci  if(0 != ioctl(0, FIONBIO, &flags))
26113498266Sopenharmony_ci    return 1;
26213498266Sopenharmony_ci  ;
26313498266Sopenharmony_ci  return 0;
26413498266Sopenharmony_ci}
26513498266Sopenharmony_ci#endif
26613498266Sopenharmony_ci
26713498266Sopenharmony_ci#ifdef HAVE_IOCTL_SIOCGIFADDR
26813498266Sopenharmony_ci/* headers for FIONBIO test */
26913498266Sopenharmony_ci/* includes start */
27013498266Sopenharmony_ci#ifdef HAVE_SYS_TYPES_H
27113498266Sopenharmony_ci#  include <sys/types.h>
27213498266Sopenharmony_ci#endif
27313498266Sopenharmony_ci#ifdef HAVE_UNISTD_H
27413498266Sopenharmony_ci#  include <unistd.h>
27513498266Sopenharmony_ci#endif
27613498266Sopenharmony_ci#ifdef HAVE_SYS_SOCKET_H
27713498266Sopenharmony_ci#  include <sys/socket.h>
27813498266Sopenharmony_ci#endif
27913498266Sopenharmony_ci#ifdef HAVE_SYS_IOCTL_H
28013498266Sopenharmony_ci#  include <sys/ioctl.h>
28113498266Sopenharmony_ci#endif
28213498266Sopenharmony_ci#ifdef HAVE_STROPTS_H
28313498266Sopenharmony_ci#  include <stropts.h>
28413498266Sopenharmony_ci#endif
28513498266Sopenharmony_ci#include <net/if.h>
28613498266Sopenharmony_ciint main(void)
28713498266Sopenharmony_ci{
28813498266Sopenharmony_ci  struct ifreq ifr;
28913498266Sopenharmony_ci  if(0 != ioctl(0, SIOCGIFADDR, &ifr))
29013498266Sopenharmony_ci    return 1;
29113498266Sopenharmony_ci  ;
29213498266Sopenharmony_ci  return 0;
29313498266Sopenharmony_ci}
29413498266Sopenharmony_ci#endif
29513498266Sopenharmony_ci
29613498266Sopenharmony_ci#ifdef HAVE_SETSOCKOPT_SO_NONBLOCK
29713498266Sopenharmony_ci/* includes start */
29813498266Sopenharmony_ci#ifdef _WIN32
29913498266Sopenharmony_ci#  ifndef WIN32_LEAN_AND_MEAN
30013498266Sopenharmony_ci#    define WIN32_LEAN_AND_MEAN
30113498266Sopenharmony_ci#  endif
30213498266Sopenharmony_ci#  include <winsock2.h>
30313498266Sopenharmony_ci#endif
30413498266Sopenharmony_ci/* includes start */
30513498266Sopenharmony_ci#ifdef HAVE_SYS_TYPES_H
30613498266Sopenharmony_ci#  include <sys/types.h>
30713498266Sopenharmony_ci#endif
30813498266Sopenharmony_ci#ifdef HAVE_SYS_SOCKET_H
30913498266Sopenharmony_ci#  include <sys/socket.h>
31013498266Sopenharmony_ci#endif
31113498266Sopenharmony_ci/* includes end */
31213498266Sopenharmony_ciint main(void)
31313498266Sopenharmony_ci{
31413498266Sopenharmony_ci  if(0 != setsockopt(0, SOL_SOCKET, SO_NONBLOCK, 0, 0))
31513498266Sopenharmony_ci    return 1;
31613498266Sopenharmony_ci  ;
31713498266Sopenharmony_ci  return 0;
31813498266Sopenharmony_ci}
31913498266Sopenharmony_ci#endif
32013498266Sopenharmony_ci
32113498266Sopenharmony_ci#ifdef HAVE_GLIBC_STRERROR_R
32213498266Sopenharmony_ci#include <string.h>
32313498266Sopenharmony_ci#include <errno.h>
32413498266Sopenharmony_ci
32513498266Sopenharmony_civoid check(char c) {}
32613498266Sopenharmony_ci
32713498266Sopenharmony_ciint main(void)
32813498266Sopenharmony_ci{
32913498266Sopenharmony_ci  char buffer[1024];
33013498266Sopenharmony_ci  /* This will not compile if strerror_r does not return a char* */
33113498266Sopenharmony_ci  check(strerror_r(EACCES, buffer, sizeof(buffer))[0]);
33213498266Sopenharmony_ci  return 0;
33313498266Sopenharmony_ci}
33413498266Sopenharmony_ci#endif
33513498266Sopenharmony_ci
33613498266Sopenharmony_ci#ifdef HAVE_POSIX_STRERROR_R
33713498266Sopenharmony_ci#include <string.h>
33813498266Sopenharmony_ci#include <errno.h>
33913498266Sopenharmony_ci
34013498266Sopenharmony_ci/* float, because a pointer can't be implicitly cast to float */
34113498266Sopenharmony_civoid check(float f) {}
34213498266Sopenharmony_ci
34313498266Sopenharmony_ciint main(void)
34413498266Sopenharmony_ci{
34513498266Sopenharmony_ci  char buffer[1024];
34613498266Sopenharmony_ci  /* This will not compile if strerror_r does not return an int */
34713498266Sopenharmony_ci  check(strerror_r(EACCES, buffer, sizeof(buffer)));
34813498266Sopenharmony_ci  return 0;
34913498266Sopenharmony_ci}
35013498266Sopenharmony_ci#endif
35113498266Sopenharmony_ci
35213498266Sopenharmony_ci#ifdef HAVE_FSETXATTR_6
35313498266Sopenharmony_ci#include <sys/xattr.h> /* header from libc, not from libattr */
35413498266Sopenharmony_ciint main(void)
35513498266Sopenharmony_ci{
35613498266Sopenharmony_ci  fsetxattr(0, 0, 0, 0, 0, 0);
35713498266Sopenharmony_ci  return 0;
35813498266Sopenharmony_ci}
35913498266Sopenharmony_ci#endif
36013498266Sopenharmony_ci
36113498266Sopenharmony_ci#ifdef HAVE_FSETXATTR_5
36213498266Sopenharmony_ci#include <sys/xattr.h> /* header from libc, not from libattr */
36313498266Sopenharmony_ciint main(void)
36413498266Sopenharmony_ci{
36513498266Sopenharmony_ci  fsetxattr(0, 0, 0, 0, 0);
36613498266Sopenharmony_ci  return 0;
36713498266Sopenharmony_ci}
36813498266Sopenharmony_ci#endif
36913498266Sopenharmony_ci
37013498266Sopenharmony_ci#ifdef HAVE_CLOCK_GETTIME_MONOTONIC
37113498266Sopenharmony_ci#include <time.h>
37213498266Sopenharmony_ciint main(void)
37313498266Sopenharmony_ci{
37413498266Sopenharmony_ci  struct timespec ts = {0, 0};
37513498266Sopenharmony_ci  clock_gettime(CLOCK_MONOTONIC, &ts);
37613498266Sopenharmony_ci  return 0;
37713498266Sopenharmony_ci}
37813498266Sopenharmony_ci#endif
37913498266Sopenharmony_ci
38013498266Sopenharmony_ci#ifdef HAVE_BUILTIN_AVAILABLE
38113498266Sopenharmony_ciint main(void)
38213498266Sopenharmony_ci{
38313498266Sopenharmony_ci  if(__builtin_available(macOS 10.12, *)) {}
38413498266Sopenharmony_ci  return 0;
38513498266Sopenharmony_ci}
38613498266Sopenharmony_ci#endif
38713498266Sopenharmony_ci
38813498266Sopenharmony_ci#ifdef HAVE_ATOMIC
38913498266Sopenharmony_ci/* includes start */
39013498266Sopenharmony_ci#ifdef HAVE_SYS_TYPES_H
39113498266Sopenharmony_ci#  include <sys/types.h>
39213498266Sopenharmony_ci#endif
39313498266Sopenharmony_ci#ifdef HAVE_UNISTD_H
39413498266Sopenharmony_ci#  include <unistd.h>
39513498266Sopenharmony_ci#endif
39613498266Sopenharmony_ci#ifdef HAVE_STDATOMIC_H
39713498266Sopenharmony_ci#  include <stdatomic.h>
39813498266Sopenharmony_ci#endif
39913498266Sopenharmony_ci/* includes end */
40013498266Sopenharmony_ci
40113498266Sopenharmony_ciint main(void)
40213498266Sopenharmony_ci{
40313498266Sopenharmony_ci  _Atomic int i = 1;
40413498266Sopenharmony_ci  i = 0;  /* Force an atomic-write operation. */
40513498266Sopenharmony_ci  return i;
40613498266Sopenharmony_ci}
40713498266Sopenharmony_ci#endif
40813498266Sopenharmony_ci
40913498266Sopenharmony_ci#ifdef HAVE_WIN32_WINNT
41013498266Sopenharmony_ci/* includes start */
41113498266Sopenharmony_ci#ifdef _WIN32
41213498266Sopenharmony_ci#  ifndef WIN32_LEAN_AND_MEAN
41313498266Sopenharmony_ci#    define WIN32_LEAN_AND_MEAN
41413498266Sopenharmony_ci#  endif
41513498266Sopenharmony_ci#  ifndef NOGDI
41613498266Sopenharmony_ci#    define NOGDI
41713498266Sopenharmony_ci#  endif
41813498266Sopenharmony_ci#  include <windows.h>
41913498266Sopenharmony_ci#endif
42013498266Sopenharmony_ci/* includes end */
42113498266Sopenharmony_ci
42213498266Sopenharmony_ci#define enquote(x) #x
42313498266Sopenharmony_ci#define expand(x) enquote(x)
42413498266Sopenharmony_ci#pragma message("_WIN32_WINNT=" expand(_WIN32_WINNT))
42513498266Sopenharmony_ci
42613498266Sopenharmony_ciint main(void)
42713498266Sopenharmony_ci{
42813498266Sopenharmony_ci  return 0;
42913498266Sopenharmony_ci}
43013498266Sopenharmony_ci#endif
431