Skip to content

Commit 0c6cec9

Browse files
authored
Fix name mangling when using a C++ compiler (#7)
1 parent 52b1a0f commit 0c6cec9

File tree

11 files changed

+88
-0
lines changed

11 files changed

+88
-0
lines changed

include/FreeRTOS_POSIX/errno.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@
3636
#ifndef _FREERTOS_POSIX_ERRNO_H_
3737
#define _FREERTOS_POSIX_ERRNO_H_
3838

39+
#ifdef __cplusplus
40+
extern "C" {
41+
#endif
42+
3943
/* Undefine all errnos to avoid redefinition errors with system errnos. */
4044
#undef EPERM
4145
#undef ENOENT
@@ -92,4 +96,8 @@
9296
#endif
9397
/**@} */
9498

99+
#ifdef __cplusplus
100+
}
101+
#endif
102+
95103
#endif /* ifndef _FREERTOS_POSIX_ERRNO_H_ */

include/FreeRTOS_POSIX/fcntl.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
#ifndef _FREERTOS_POSIX_FCNTL_H_
3434
#define _FREERTOS_POSIX_FCNTL_H_
3535

36+
#ifdef __cplusplus
37+
extern "C" {
38+
#endif
39+
3640
/**
3741
* @name File creation flags for use in the oflag value to open() and openat().
3842
*/
@@ -76,4 +80,8 @@
7680
#define O_WRONLY 0x8000 /**< Open for writing only. */
7781
/**@} */
7882

83+
#ifdef __cplusplus
84+
}
85+
#endif
86+
7987
#endif /* ifndef _FREERTOS_POSIX_FCNTL_H_ */

include/FreeRTOS_POSIX/mqueue.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
#ifndef _FREERTOS_POSIX_MQUEUE_H_
3434
#define _FREERTOS_POSIX_MQUEUE_H_
3535

36+
#ifdef __cplusplus
37+
extern "C" {
38+
#endif
39+
3640
/* FreeRTOS+POSIX includes. */
3741
#include "FreeRTOS_POSIX/time.h"
3842

@@ -247,4 +251,8 @@ int mq_timedsend( mqd_t mqdes,
247251
*/
248252
int mq_unlink( const char * name );
249253

254+
#ifdef __cplusplus
255+
}
256+
#endif
257+
250258
#endif /* ifndef _FREERTOS_POSIX_MQUEUE_H_ */

include/FreeRTOS_POSIX/pthread.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
#ifndef _FREERTOS_POSIX_PTHREAD_H_
3434
#define _FREERTOS_POSIX_PTHREAD_H_
3535

36+
#ifdef __cplusplus
37+
extern "C" {
38+
#endif
39+
3640
/* FreeRTOS+POSIX includes. POSIX states that this header shall make symbols
3741
* defined in sched.h and time.h visible. */
3842
#include "FreeRTOS_POSIX/sched.h"
@@ -498,4 +502,8 @@ int pthread_setschedparam( pthread_t thread,
498502
int policy,
499503
const struct sched_param * param );
500504

505+
#ifdef __cplusplus
506+
}
507+
#endif
508+
501509
#endif /* _FREERTOS_POSIX_PTHREAD_H_ */

include/FreeRTOS_POSIX/sched.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
#ifndef _FREERTOS_POSIX_SCHED_H_
3434
#define _FREERTOS_POSIX_SCHED_H_
3535

36+
#ifdef __cplusplus
37+
extern "C" {
38+
#endif
39+
3640
/**
3741
* @name Scheduling Policies
3842
*/
@@ -81,4 +85,8 @@ int sched_get_priority_min( int policy );
8185
*/
8286
int sched_yield( void );
8387

88+
#ifdef __cplusplus
89+
}
90+
#endif
91+
8492
#endif /* ifndef _FREERTOS_POSIX_SCHED_H_ */

include/FreeRTOS_POSIX/semaphore.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@
3737
#include "FreeRTOS_POSIX/time.h"
3838
#include "FreeRTOS_POSIX_types.h"
3939

40+
#ifdef __cplusplus
41+
extern "C" {
42+
#endif
43+
4044
/**
4145
* @brief Semaphore type.
4246
*/
@@ -140,4 +144,8 @@ int sem_trywait( sem_t * sem );
140144
*/
141145
int sem_wait( sem_t * sem );
142146

147+
#ifdef __cplusplus
148+
}
149+
#endif
150+
143151
#endif /* ifndef _FREERTOS_POSIX_SEMAPHORE_H_ */

include/FreeRTOS_POSIX/signal.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@
3737
#ifndef _FREERTOS_POSIX_SIGNAL_H_
3838
#define _FREERTOS_POSIX_SIGNAL_H_
3939

40+
#ifdef __cplusplus
41+
extern "C" {
42+
#endif
43+
4044
/**
4145
* @name Values of sigev_notify.
4246
*/
@@ -67,4 +71,8 @@ struct sigevent
6771
pthread_attr_t * sigev_notify_attributes; /**< Notification attributes. */
6872
};
6973

74+
#ifdef __cplusplus
75+
}
76+
#endif
77+
7078
#endif /* ifndef _FREERTOS_POSIX_SIGNAL_H_ */

include/FreeRTOS_POSIX/sys/types.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
#ifndef _FREERTOS_POSIX_TYPES_H_
3434
#define _FREERTOS_POSIX_TYPES_H_
3535

36+
#ifdef __cplusplus
37+
extern "C" {
38+
#endif
39+
3640
/* C standard library includes. */
3741
#include <stdint.h>
3842

@@ -188,4 +192,8 @@ typedef void * pthread_barrierattr_t;
188192
typedef long int off_t;
189193
#endif
190194

195+
#ifdef __cplusplus
196+
}
197+
#endif
198+
191199
#endif /* ifndef _FREERTOS_POSIX_TYPES_H_ */

include/FreeRTOS_POSIX/time.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
#ifndef _FREERTOS_POSIX_TIME_H_
3434
#define _FREERTOS_POSIX_TIME_H_
3535

36+
#ifdef __cplusplus
37+
extern "C" {
38+
#endif
39+
3640
/* FreeRTOS+POSIX includes. */
3741
#include "FreeRTOS_POSIX/sys/types.h"
3842
#include "FreeRTOS_POSIX/signal.h"
@@ -255,4 +259,8 @@ int timer_settime( timer_t timerid,
255259
const struct itimerspec * value,
256260
struct itimerspec * ovalue );
257261

262+
#ifdef __cplusplus
263+
}
264+
#endif
265+
258266
#endif /* ifndef _FREERTOS_POSIX_TIME_H_ */

include/FreeRTOS_POSIX/unistd.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
#ifndef _FREERTOS_POSIX_UNISTD_H_
3434
#define _FREERTOS_POSIX_UNISTD_H_
3535

36+
#ifdef __cplusplus
37+
extern "C" {
38+
#endif
39+
3640
#include "FreeRTOS_POSIX/sys/types.h"
3741

3842
/**
@@ -58,4 +62,8 @@ unsigned sleep( unsigned seconds );
5862
*/
5963
int usleep( useconds_t usec );
6064

65+
#ifdef __cplusplus
66+
}
67+
#endif
68+
6169
#endif /* ifndef _FREERTOS_POSIX_UNISTD_H_ */

0 commit comments

Comments
 (0)