From 74161f0f2d64317a5c602e9c72b3ebb86eb6312c Mon Sep 17 00:00:00 2001 From: BytesGalore Date: Mon, 13 Oct 2014 14:44:28 +0200 Subject: [PATCH] core: moved `#include`s outside the `extern "C"` guards --- core/include/arch/thread_arch.h | 4 ++-- core/include/atomic.h | 4 ++-- core/include/byteorder.h | 7 +++++++ core/include/clist.h | 4 ++-- core/include/config.h | 4 ++-- core/include/crash.h | 4 ++-- core/include/debug.h | 6 +++--- core/include/hwtimer.h | 8 ++++---- core/include/irq.h | 6 +++--- core/include/kernel.h | 8 ++++---- core/include/kernel_internal.h | 4 ++-- core/include/kernel_macros.h | 8 ++++++++ core/include/kernel_types.h | 9 ++++----- core/include/lpm.h | 4 ++-- core/include/msg.h | 8 ++++---- core/include/mutex.h | 4 ++-- core/include/priority_queue.h | 6 +++--- core/include/sched.h | 8 ++++---- core/include/tcb.h | 8 ++++---- core/include/thread.h | 8 ++++---- 20 files changed, 68 insertions(+), 54 deletions(-) diff --git a/core/include/arch/thread_arch.h b/core/include/arch/thread_arch.h index d41615b59..38cba2c79 100644 --- a/core/include/arch/thread_arch.h +++ b/core/include/arch/thread_arch.h @@ -19,12 +19,12 @@ #ifndef __THREAD_ARCH_H #define __THREAD_ARCH_H +#include "attributes.h" + #ifdef __cplusplus extern "C" { #endif -#include "attributes.h" - /** * @name Define the mapping between the architecture independent interfaces * and the kernel internal interfaces diff --git a/core/include/atomic.h b/core/include/atomic.h index 07fa631c1..0d6b64a32 100644 --- a/core/include/atomic.h +++ b/core/include/atomic.h @@ -19,12 +19,12 @@ #ifndef _ATOMIC_H #define _ATOMIC_H +#include "arch/atomic_arch.h" + #ifdef __cplusplus extern "C" { #endif -#include "arch/atomic_arch.h" - /** * @brief Sets a new and returns the old value of a variable atomically * diff --git a/core/include/byteorder.h b/core/include/byteorder.h index b03a841c6..9c74903c0 100644 --- a/core/include/byteorder.h +++ b/core/include/byteorder.h @@ -21,6 +21,9 @@ #include +#ifdef __cplusplus +extern "C" { +#endif /* ******************************* INTERFACE ******************************* */ @@ -310,5 +313,9 @@ uint64_t byteorder_ntohll(network_uint64_t v) return _byteorder_swap(v.u64, ll); } +#ifdef __cplusplus +} +#endif + #endif /* BYTEORDER_H_ */ /** @} */ diff --git a/core/include/clist.h b/core/include/clist.h index b9469db44..8b7218f46 100644 --- a/core/include/clist.h +++ b/core/include/clist.h @@ -19,12 +19,12 @@ #ifndef __CLIST_H #define __CLIST_H +#include "kernel_macros.h" + #ifdef __cplusplus extern "C" { #endif -#include "kernel_macros.h" - /** * @def clist_get_container(NODE, TYPE, MEMBER) * @brief Returns the container of the circular list diff --git a/core/include/config.h b/core/include/config.h index 91fcce7a3..59ef1f429 100644 --- a/core/include/config.h +++ b/core/include/config.h @@ -19,12 +19,12 @@ #ifndef CONFIG_H #define CONFIG_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - #define CONFIG_KEY (0x1701) /**< key to identify configuration */ #define CONFIG_NAME_LEN (10) /**< length of name for configuration in bytes */ diff --git a/core/include/crash.h b/core/include/crash.h index d988b6e60..44169337e 100644 --- a/core/include/crash.h +++ b/core/include/crash.h @@ -22,12 +22,12 @@ #ifndef __CRASH_H #define __CRASH_H +#include "kernel.h" + #ifdef __cplusplus extern "C" { #endif -#include "kernel.h" - /** * @brief Handle an unrecoverable error by halting or rebooting the system * diff --git a/core/include/debug.h b/core/include/debug.h index 781288f3c..a9340f34f 100644 --- a/core/include/debug.h +++ b/core/include/debug.h @@ -21,13 +21,13 @@ #ifndef __DEBUG_H #define __DEBUG_H +#include +#include "sched.h" + #ifdef __cplusplus extern "C" { #endif -#include -#include "sched.h" - /** * @name Print debug information if the calling thread stack is large enough * diff --git a/core/include/hwtimer.h b/core/include/hwtimer.h index 848db82a4..57f7fec75 100644 --- a/core/include/hwtimer.h +++ b/core/include/hwtimer.h @@ -33,14 +33,14 @@ #ifndef __HWTIMER_H #define __HWTIMER_H -#ifdef __cplusplus - extern "C" { -#endif - #include #include "hwtimer_cpu.h" #include "board.h" +#ifdef __cplusplus + extern "C" { +#endif + /** * @brief Number of kernel timer ticks per second * @def HWTIMER_SPEED diff --git a/core/include/irq.h b/core/include/irq.h index 9e53da079..8629ecfd1 100644 --- a/core/include/irq.h +++ b/core/include/irq.h @@ -21,13 +21,13 @@ #ifndef IRQ_H_ #define IRQ_H_ +#include +#include "arch/irq_arch.h" + #ifdef __cplusplus extern "C" { #endif -#include -#include "arch/irq_arch.h" - /** * @brief This function sets the IRQ disable bit in the status register * diff --git a/core/include/kernel.h b/core/include/kernel.h index c1a51fd62..863dc8346 100644 --- a/core/include/kernel.h +++ b/core/include/kernel.h @@ -22,10 +22,6 @@ #ifndef KERNEL_H_ #define KERNEL_H_ -#ifdef __cplusplus - extern "C" { -#endif - #include #include @@ -37,6 +33,10 @@ #include "sched.h" #include "cpu-conf.h" +#ifdef __cplusplus + extern "C" { +#endif + /** * @def KERNEL_CONF_STACKSIZE_DEFAULT * @brief A reasonable default stack size that will suffice most smaller tasks diff --git a/core/include/kernel_internal.h b/core/include/kernel_internal.h index 22592dce9..46823abc8 100644 --- a/core/include/kernel_internal.h +++ b/core/include/kernel_internal.h @@ -19,12 +19,12 @@ #ifndef KERNEL_INTERNAL_H_ #define KERNEL_INTERNAL_H_ +#include "attributes.h" + #ifdef __cplusplus extern "C" { #endif -#include "attributes.h" - /** * @brief Initializes scheduler and creates main and idle task */ diff --git a/core/include/kernel_macros.h b/core/include/kernel_macros.h index c2bbf812b..8e7579790 100644 --- a/core/include/kernel_macros.h +++ b/core/include/kernel_macros.h @@ -18,6 +18,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + /** * @def container_of(PTR, TYPE, MEMBER) * @brief Returns the container of a pointer to a member. @@ -50,6 +54,10 @@ ((TYPE *) ((char *) (PTR) - offsetof(TYPE, MEMBER))) #endif +#ifdef __cplusplus +} +#endif + /** * @} */ diff --git a/core/include/kernel_types.h b/core/include/kernel_types.h index 1e916cd96..356faaded 100644 --- a/core/include/kernel_types.h +++ b/core/include/kernel_types.h @@ -6,7 +6,6 @@ * directory for more details. */ - /** * @addtogroup core_util * @{ @@ -22,10 +21,6 @@ #ifndef KERNEL_TYPES_H #define KERNEL_TYPES_H -#ifdef __cplusplus - extern "C" { -#endif - #include #include #include @@ -47,6 +42,10 @@ # endif #endif +#ifdef __cplusplus + extern "C" { +#endif + /** * @def MAXTHREADS * @brief The maximum number of threads to be scheduled diff --git a/core/include/lpm.h b/core/include/lpm.h index bbce3d99f..1158db24c 100644 --- a/core/include/lpm.h +++ b/core/include/lpm.h @@ -23,12 +23,12 @@ #ifndef LPM_H_ #define LPM_H_ +#include "arch/lpm_arch.h" + #ifdef __cplusplus extern "C" { #endif -#include "arch/lpm_arch.h" - /** * @brief Initialization of power management (including clock setup) * diff --git a/core/include/msg.h b/core/include/msg.h index f915ac619..203b303de 100644 --- a/core/include/msg.h +++ b/core/include/msg.h @@ -32,14 +32,14 @@ #ifndef __MSG_H_ #define __MSG_H_ -#ifdef __cplusplus - extern "C" { -#endif - #include #include #include "kernel_types.h" +#ifdef __cplusplus + extern "C" { +#endif + /** * @brief Describes a message object which can be sent between threads. * diff --git a/core/include/mutex.h b/core/include/mutex.h index c5b16e9a2..7e002f26c 100644 --- a/core/include/mutex.h +++ b/core/include/mutex.h @@ -21,12 +21,12 @@ #ifndef __MUTEX_H_ #define __MUTEX_H_ +#include "priority_queue.h" + #ifdef __cplusplus extern "C" { #endif -#include "priority_queue.h" - /** * @brief Mutex structure. Must never be modified by the user. */ diff --git a/core/include/priority_queue.h b/core/include/priority_queue.h index f293f41cd..a4377b2ae 100644 --- a/core/include/priority_queue.h +++ b/core/include/priority_queue.h @@ -19,13 +19,13 @@ #ifndef __QUEUE_H #define __QUEUE_H +#include +#include + #ifdef __cplusplus extern "C" { #endif -#include -#include - /** * data type for priority queue nodes */ diff --git a/core/include/sched.h b/core/include/sched.h index 256fbad0c..bb47ff046 100644 --- a/core/include/sched.h +++ b/core/include/sched.h @@ -80,16 +80,16 @@ #ifndef _SCHEDULER_H #define _SCHEDULER_H -#ifdef __cplusplus - extern "C" { -#endif - #include #include "bitarithm.h" #include "tcb.h" #include "attributes.h" #include "kernel_types.h" +#ifdef __cplusplus + extern "C" { +#endif + /** * @def SCHED_PRIO_LEVELS * @brief The number of thread priority levels diff --git a/core/include/tcb.h b/core/include/tcb.h index c18ced072..239cf8965 100644 --- a/core/include/tcb.h +++ b/core/include/tcb.h @@ -20,16 +20,16 @@ #ifndef TCB_H_ #define TCB_H_ -#ifdef __cplusplus - extern "C" { -#endif - #include #include "priority_queue.h" #include "clist.h" #include "cib.h" #include "msg.h" +#ifdef __cplusplus + extern "C" { +#endif + /** * @brief Thread status list * @{ diff --git a/core/include/thread.h b/core/include/thread.h index 4ee1253e1..e255bfd8d 100644 --- a/core/include/thread.h +++ b/core/include/thread.h @@ -21,14 +21,14 @@ #ifndef __THREAD_H #define __THREAD_H -#ifdef __cplusplus - extern "C" { -#endif - #include "kernel.h" #include "tcb.h" #include "arch/thread_arch.h" +#ifdef __cplusplus + extern "C" { +#endif + #define STATUS_NOT_FOUND (-1) /**