mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2026-03-20 19:21:09 +01:00
Start from a clean baseline for C11 ext1 and POSIX features
Define `_POSIX_C_SOURCE` and `_XOPEN_SOURCE` in a single place that applies everywhere, to make things simple. This may break some platforms that require special handling for POSIX functions and types. Subsequent commits will add platform-specific hacks as needed. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
@@ -15,6 +15,20 @@
|
||||
#ifndef MBEDTLS_MBEDTLS_PLATFORM_REQUIREMENTS_H
|
||||
#define MBEDTLS_MBEDTLS_PLATFORM_REQUIREMENTS_H
|
||||
|
||||
#if !defined(_POSIX_C_SOURCE)
|
||||
/* For standards-compliant access to
|
||||
* getaddrinfo(),
|
||||
* ... */
|
||||
#define _POSIX_C_SOURCE 200112L
|
||||
#endif
|
||||
|
||||
#if !defined(_XOPEN_SOURCE)
|
||||
/* For standards-compliant access to
|
||||
* sockaddr_storage,
|
||||
* ... */
|
||||
#define _XOPEN_SOURCE 600
|
||||
#endif
|
||||
|
||||
/* On Mingw-w64, force the use of a C99-compliant printf() and friends.
|
||||
* This is necessary on older versions of Mingw and/or Windows runtimes
|
||||
* where snprintf does not always zero-terminate the buffer, and does
|
||||
|
||||
@@ -5,16 +5,6 @@
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
/* Enable definition of getaddrinfo() even when compiling with -std=c99. Must
|
||||
* be set before mbedtls_config.h, which pulls in glibc's features.h indirectly.
|
||||
* Harmless on other platforms. */
|
||||
#ifndef _POSIX_C_SOURCE
|
||||
#define _POSIX_C_SOURCE 200112L
|
||||
#endif
|
||||
#ifndef _XOPEN_SOURCE
|
||||
#define _XOPEN_SOURCE 600 /* sockaddr_storage */
|
||||
#endif
|
||||
|
||||
#include "ssl_misc.h"
|
||||
|
||||
#if defined(MBEDTLS_NET_C)
|
||||
|
||||
Reference in New Issue
Block a user