Skip to content

Commit d3690c9

Browse files
committed
cores/arduino/abi: squash warning
Use a global 'extern "C" { }' block to avoid warnings about variables being initialized and declared extern. Signed-off-by: Luca Burelli <[email protected]>
1 parent c43e487 commit d3690c9

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

cores/arduino/abi.cpp

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,29 @@
66

77
#include <stdlib.h>
88

9-
extern "C" void __cxa_pure_virtual(void) {}
10-
extern "C" void __cxa_deleted_virtual(void) {}
11-
extern "C" int __cxa_atexit(void (*func) (void *), void * arg, void * dso_handle) {
9+
namespace std {
10+
void __throw_length_error(const char* __s __attribute__((unused))) {}
11+
void __throw_bad_alloc() {}
12+
void __throw_bad_function_call() {}
13+
};
14+
15+
extern "C" {
16+
17+
void* __dso_handle = (void*) &__dso_handle;
18+
19+
void __cxa_pure_virtual(void) {}
20+
void __cxa_deleted_virtual(void) {}
21+
int __cxa_atexit(void (*func) (void *), void * arg, void * dso_handle) {
1222
(void)func; (void)arg; (void)dso_handle; // unused
1323
return 0;
1424
}
15-
extern "C" int atexit(void (*func)(void)) {
25+
26+
int atexit(void (*func)(void)) {
1627
(void)func;
1728
return 0;
1829
}
1930

20-
namespace std {
21-
void __throw_length_error(const char* __s __attribute__((unused))) {}
22-
void __throw_bad_alloc() {}
23-
void __throw_bad_function_call() {}
24-
};
25-
26-
extern "C" int strcmp(const char* s1, const char* s2) {
31+
int strcmp(const char* s1, const char* s2) {
2732
while(*s1 && (*s1 == *s2))
2833
{
2934
s1++;
@@ -32,4 +37,4 @@ extern "C" int strcmp(const char* s1, const char* s2) {
3237
return *(const unsigned char*)s1 - *(const unsigned char*)s2;
3338
}
3439

35-
extern "C" void* __dso_handle = (void*) &__dso_handle;
40+
} /* extern "C" */

0 commit comments

Comments
 (0)