mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-04 13:14:32 +02:00
newlib: Fix header issues with C++ guards and implicit inclusion
* Added C++ sentinels if missed * Used #pragma once, removed macro's with leading underscores * Updated copyright checker to allow "BSD-2-Clause-FreeBSD AND Apache-2.0" for newlib files * Fixed minor compilation issues/implicit inclusions
This commit is contained in:
@@ -50,6 +50,10 @@
|
|||||||
*/
|
*/
|
||||||
#include <machine/endian.h>
|
#include <machine/endian.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* General byte order swapping functions.
|
* General byte order swapping functions.
|
||||||
*/
|
*/
|
||||||
@@ -198,3 +202,7 @@ le64enc(void *pp, uint64_t u)
|
|||||||
le32enc(p, (uint32_t)(u & 0xffffffffU));
|
le32enc(p, (uint32_t)(u & 0xffffffffU));
|
||||||
le32enc(p + 4, (uint32_t)(u >> 32));
|
le32enc(p + 4, (uint32_t)(u >> 32));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
@@ -4,11 +4,14 @@
|
|||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __ESP_NEWLIB_H__
|
#pragma once
|
||||||
#define __ESP_NEWLIB_H__
|
|
||||||
|
|
||||||
#include <sys/reent.h>
|
#include <sys/reent.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize newlib time functions
|
* Initialize newlib time functions
|
||||||
*/
|
*/
|
||||||
@@ -57,4 +60,6 @@ void esp_sync_timekeeping_timers(void);
|
|||||||
*/
|
*/
|
||||||
void esp_newlib_locks_init(void);
|
void esp_newlib_locks_init(void);
|
||||||
|
|
||||||
#endif //__ESP_NEWLIB_H__
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
@@ -8,8 +8,16 @@
|
|||||||
|
|
||||||
#include_next<sys/reent.h>
|
#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
|
/* 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,
|
* There is no nice way to get __cleanup member populated while avoiding __sinit,
|
||||||
* so extern declaration is used here.
|
* so extern declaration is used here.
|
||||||
*/
|
*/
|
||||||
extern void _cleanup_r(struct _reent* r);
|
extern void _cleanup_r(struct _reent* r);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
@@ -3,8 +3,11 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
#ifndef _ESP_PLATFORM_SYS_UN_H_
|
#pragma once
|
||||||
#define _ESP_PLATFORM_SYS_UN_H_
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
#define AF_UNIX 1 /* local to host (pipes) */
|
#define AF_UNIX 1 /* local to host (pipes) */
|
||||||
|
|
||||||
@@ -13,4 +16,6 @@ struct sockaddr_un {
|
|||||||
char sun_path[108]; /*path name */
|
char sun_path[108]; /*path name */
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _ESP_PLATFORM_SYS_UN_H_
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
@@ -4,20 +4,19 @@
|
|||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
#ifndef _ESP_SYS_UNISTD_H
|
#include <sys/types.h>
|
||||||
#define _ESP_SYS_UNISTD_H
|
|
||||||
|
#include_next <sys/unistd.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include_next <sys/unistd.h>
|
|
||||||
|
|
||||||
int truncate(const char *, off_t __length);
|
int truncate(const char *, off_t __length);
|
||||||
int gethostname(char *__name, size_t __len);
|
int gethostname(char *__name, size_t __len);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* _SYS_UNISTD_H */
|
|
||||||
|
@@ -4,14 +4,15 @@
|
|||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
#ifndef _ESP_TIME_H
|
#include <sys/types.h>
|
||||||
#define _ESP_TIME_H
|
|
||||||
|
#include_next <time.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
#include_next <time.h>
|
|
||||||
|
|
||||||
#define _POSIX_TIMERS 1
|
#define _POSIX_TIMERS 1
|
||||||
#ifndef CLOCK_MONOTONIC
|
#ifndef CLOCK_MONOTONIC
|
||||||
@@ -28,4 +29,3 @@ int clock_getres(clockid_t clock_id, struct timespec *res);
|
|||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* _ESP_TIME_H */
|
|
||||||
|
@@ -67,6 +67,14 @@ lwip_component:
|
|||||||
- BSD-3-Clause
|
- BSD-3-Clause
|
||||||
license_for_new_files: Apache-2.0
|
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:
|
asio_component:
|
||||||
include:
|
include:
|
||||||
- 'components/asio/port/**'
|
- 'components/asio/port/**'
|
||||||
|
@@ -7,7 +7,6 @@ components/xtensa/esp32s2/include/xtensa/config/
|
|||||||
components/xtensa/esp32s3/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/esp_additions/include/freertos_tasks_c_additions.h
|
||||||
components/freertos/FreeRTOS-Kernel/include/freertos/
|
components/freertos/FreeRTOS-Kernel/include/freertos/
|
||||||
|
Reference in New Issue
Block a user