Skip to content

Commit a2d16f3

Browse files
authored
Extern C blocks (#1352) (#4044)
* Add extern C guard blocks to SDK header files #1352 * fixed some extern C blocks in core and libraries
1 parent 1cd4a00 commit a2d16f3

File tree

21 files changed

+165
-11
lines changed

21 files changed

+165
-11
lines changed

cores/esp8266/pgmspace.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
#include <stdint.h>
55
#include <stdio.h>
66

7-
#ifdef __cplusplus
8-
extern "C" {
9-
#endif
107

118
#ifdef __ets__
129

@@ -26,6 +23,10 @@ extern "C" {
2623
#endif // __ets__
2724

2825

26+
#ifdef __cplusplus
27+
extern "C" {
28+
#endif
29+
2930
#define _SFR_BYTE(n) (n)
3031

3132
typedef void prog_void;

cores/esp8266/umm_malloc/umm_malloc_cfg.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
#define _UMM_MALLOC_CFG_H
77

88
#include <debug.h>
9-
#ifdef __cplusplus
10-
extern "C" {
11-
#endif
9+
//#ifdef __cplusplus
10+
//extern "C" {
11+
//#endif
1212
#include "c_types.h"
13-
#ifdef __cplusplus
14-
}
15-
#endif
13+
//#ifdef __cplusplus
14+
//}
15+
//#endif
1616
/*
1717
* There are a number of defines you can set at compile time that affect how
1818
* the memory allocator will operate.

libraries/GDBStub/src/internal/gdbstub-entry.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ int gdbstub_del_hw_watchpoint(int addr);
1919
extern void* gdbstub_do_break_breakpoint_addr;
2020

2121
#ifdef __cplusplus
22-
{
22+
}
2323
#endif
2424

25-
#endif
25+
#endif

tools/sdk/include/at_custom.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727

2828
#include "c_types.h"
2929

30+
#ifdef __cplusplus
31+
extern "C" {
32+
#endif
33+
3034
typedef struct
3135
{
3236
char *at_cmdName;
@@ -169,4 +173,8 @@ bool at_fake_uart_enable(bool enable,at_fake_uart_tx_func_type at_fake_uart_tx_f
169173
*/
170174
bool at_set_escape_character(uint8 ch);
171175

176+
#ifdef __cplusplus
177+
}
178+
#endif
179+
172180
#endif

tools/sdk/include/espconn.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
#ifndef __ESPCONN_H__
2626
#define __ESPCONN_H__
2727

28+
#ifdef __cplusplus
29+
extern "C" {
30+
#endif
31+
2832
typedef sint8 err_t;
2933

3034
typedef void *espconn_handle;
@@ -742,5 +746,13 @@ void espconn_dns_setserver(uint8 numdns, ip_addr_t *dnsserver);
742746
* Returns : dnsserver -- IP address of the DNS server to set
743747
*******************************************************************************/
744748
ip_addr_t espconn_dns_getserver(uint8 numdns);
749+
750+
751+
#ifdef __cplusplus
752+
}
745753
#endif
746754

755+
#endif
756+
757+
758+

tools/sdk/include/espnow.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525
#ifndef __ESPNOW_H__
2626
#define __ESPNOW_H__
2727

28+
29+
#ifdef __cplusplus
30+
extern "C" {
31+
#endif
32+
2833
enum esp_now_role {
2934
ESP_NOW_ROLE_IDLE = 0,
3035
ESP_NOW_ROLE_CONTROLLER,
@@ -70,4 +75,8 @@ int esp_now_get_cnt_info(u8 *all_cnt, u8 *encrypt_cnt);
7075

7176
int esp_now_set_kok(u8 *key, u8 len);
7277

78+
#ifdef __cplusplus
79+
}
80+
#endif
81+
7382
#endif

tools/sdk/include/ets_sys.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929
#include "eagle_soc.h"
3030
#include <stddef.h>
3131

32+
#ifdef __cplusplus
33+
extern "C" {
34+
#endif
35+
3236
typedef uint32_t ETSSignal;
3337
typedef uint32_t ETSParam;
3438

@@ -213,4 +217,8 @@ bool ets_task(ETSTask task, uint8 prio, ETSEvent *queue, uint8 qlen);
213217
bool ets_post(uint8 prio, ETSSignal sig, ETSParam par);
214218

215219

220+
#ifdef __cplusplus
221+
}
222+
#endif
223+
216224
#endif /* _ETS_SYS_H */

tools/sdk/include/gpio.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
#ifndef _GPIO_H_
2626
#define _GPIO_H_
2727

28+
#ifdef __cplusplus
29+
extern "C" {
30+
#endif
31+
2832
#define GPIO_PIN_ADDR(i) (GPIO_PIN0_ADDRESS + i*4)
2933

3034
#define GPIO_ID_IS_PIN_REGISTER(reg_id) \
@@ -116,4 +120,8 @@ void gpio_pin_wakeup_disable();
116120

117121
void gpio_pin_intr_state_set(uint32 i, GPIO_INT_TYPE intr_state);
118122

123+
#ifdef __cplusplus
124+
}
125+
#endif
126+
119127
#endif // _GPIO_H_

tools/sdk/include/ip_addr.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727

2828
#include "c_types.h"
2929

30+
#ifdef __cplusplus
31+
extern "C" {
32+
#endif
33+
3034
struct ip_addr {
3135
uint32 addr;
3236
};
@@ -84,4 +88,9 @@ uint32 ipaddr_addr(const char *cp);
8488

8589
#define IPSTR "%d.%d.%d.%d"
8690

91+
92+
#ifdef __cplusplus
93+
}
94+
#endif
95+
8796
#endif /* __IP_ADDR_H__ */

tools/sdk/include/mem.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
#ifndef __MEM_H__
2626
#define __MEM_H__
2727

28+
#ifdef __cplusplus
29+
extern "C" {
30+
#endif
31+
2832
/* Note: check_memleak_debug_enable is a weak function inside SDK.
2933
* please copy following codes to user_main.c.
3034
#include "mem.h"
@@ -77,5 +81,10 @@ do{\
7781

7882
#endif
7983

84+
85+
#ifdef __cplusplus
86+
}
87+
#endif
88+
8089
#endif
8190

0 commit comments

Comments
 (0)