Merge branch 'bugfix/cpp_include_fix_newlib_net_if_h' into 'master'

Add C++ include guard to if.h (to fix linker errors in asio) (GitHub PR)

Closes IDFGH-7718

See merge request espressif/esp-idf!18850
This commit is contained in:
David Čermák 2022-07-15 13:16:47 +08:00
commit 1a7dfa42e6
9 changed files with 56 additions and 16 deletions

View File

@ -50,6 +50,10 @@
*/
#include <machine/endian.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* General byte order swapping functions.
*/
@ -198,3 +202,7 @@ le64enc(void *pp, uint64_t u)
le32enc(p, (uint32_t)(u & 0xffffffffU));
le32enc(p + 4, (uint32_t)(u >> 32));
}
#ifdef __cplusplus
}
#endif

View File

@ -4,11 +4,14 @@
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef __ESP_NEWLIB_H__
#define __ESP_NEWLIB_H__
#pragma once
#include <sys/reent.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Initialize newlib time functions
*/
@ -57,4 +60,6 @@ void esp_sync_timekeeping_timers(void);
*/
void esp_newlib_locks_init(void);
#endif //__ESP_NEWLIB_H__
#ifdef __cplusplus
}
#endif

View File

@ -6,6 +6,10 @@
#ifndef _ESP_PLATFORM_NET_IF_H_
#define _ESP_PLATFORM_NET_IF_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "lwip/sockets.h"
#include "lwip/if_api.h"
@ -29,4 +33,8 @@ unsigned int if_nametoindex(const char *ifname);
char *if_indextoname(unsigned int ifindex, char *ifname);
#ifdef __cplusplus
}
#endif
#endif // _ESP_PLATFORM_NET_IF_H_

View File

@ -8,8 +8,16 @@
#include_next<sys/reent.h>
#ifdef __cplusplus
extern "C" {
#endif
/* This function is not part of the newlib API, it is defined in libc/stdio/local.h
* There is no nice way to get __cleanup member populated while avoiding __sinit,
* so extern declaration is used here.
*/
extern void _cleanup_r(struct _reent* r);
#ifdef __cplusplus
}
#endif

View File

@ -3,8 +3,11 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef _ESP_PLATFORM_SYS_UN_H_
#define _ESP_PLATFORM_SYS_UN_H_
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#define AF_UNIX 1 /* local to host (pipes) */
@ -13,4 +16,6 @@ struct sockaddr_un {
char sun_path[108]; /*path name */
};
#endif // _ESP_PLATFORM_SYS_UN_H_
#ifdef __cplusplus
}
#endif

View File

@ -4,20 +4,19 @@
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#ifndef _ESP_SYS_UNISTD_H
#define _ESP_SYS_UNISTD_H
#include <sys/types.h>
#include_next <sys/unistd.h>
#ifdef __cplusplus
extern "C" {
#endif
#include_next <sys/unistd.h>
int truncate(const char *, off_t __length);
int gethostname(char *__name, size_t __len);
#ifdef __cplusplus
}
#endif
#endif /* _SYS_UNISTD_H */

View File

@ -4,14 +4,15 @@
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#ifndef _ESP_TIME_H
#define _ESP_TIME_H
#include <sys/types.h>
#include_next <time.h>
#ifdef __cplusplus
extern "C" {
#endif
#include_next <time.h>
#define _POSIX_TIMERS 1
#ifndef CLOCK_MONOTONIC
@ -28,4 +29,3 @@ int clock_getres(clockid_t clock_id, struct timespec *res);
#ifdef __cplusplus
}
#endif
#endif /* _ESP_TIME_H */

View File

@ -67,6 +67,14 @@ lwip_component:
- BSD-3-Clause
license_for_new_files: Apache-2.0
newlib_component:
include:
- 'components/newlib/**'
allowed_licenses:
- Apache-2.0
- BSD-2-Clause-FreeBSD AND Apache-2.0
license_for_new_files: Apache-2.0
asio_component:
include:
- 'components/asio/port/**'

View File

@ -7,7 +7,6 @@ components/xtensa/esp32s2/include/xtensa/config/
components/xtensa/esp32s3/include/xtensa/config/
components/newlib/platform_include/
components/freertos/esp_additions/include/freertos_tasks_c_additions.h
components/freertos/FreeRTOS-Kernel/include/freertos/