diff --git a/libn3ds/kernel/include/internal/contextswitch.h b/libn3ds/kernel/include/internal/contextswitch.h
index 0f50bd0..a8d0afe 100644
--- a/libn3ds/kernel/include/internal/contextswitch.h
+++ b/libn3ds/kernel/include/internal/contextswitch.h
@@ -46,4 +46,4 @@ KRes switchContext(KRes res, uintptr_t *oldSp, uintptr_t newSp);
#ifdef __cplusplus
}
-#endif
+#endif
\ No newline at end of file
diff --git a/libn3ds/kernel/include/internal/kernel_private.h b/libn3ds/kernel/include/internal/kernel_private.h
index 55280cf..79e951f 100644
--- a/libn3ds/kernel/include/internal/kernel_private.h
+++ b/libn3ds/kernel/include/internal/kernel_private.h
@@ -18,8 +18,6 @@
* along with this program. If not, see .
*/
-#include
-#include
#include
#include "types.h"
#include "internal/list.h"
@@ -75,4 +73,4 @@ static inline void kernelUnlock(void)
void _eventSlabInit(void);
void _mutexSlabInit(void);
void _semaphoreSlabInit(void);
-void _timerInit(void);
+void _timerInit(void);
\ No newline at end of file
diff --git a/libn3ds/kernel/include/internal/slabheap.h b/libn3ds/kernel/include/internal/slabheap.h
index bf967be..761318e 100644
--- a/libn3ds/kernel/include/internal/slabheap.h
+++ b/libn3ds/kernel/include/internal/slabheap.h
@@ -22,6 +22,11 @@
#include "internal/list.h"
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
typedef ListNode SlabHeap;
@@ -61,3 +66,7 @@ void* slabCalloc(SlabHeap *slab, size_t clrSize);
* @param ptr The object slot pointer.
*/
void slabFree(SlabHeap *slab, void *ptr);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
\ No newline at end of file
diff --git a/libn3ds/kernel/include/internal/spinlock.h b/libn3ds/kernel/include/internal/spinlock.h
index d2b312f..591c7f8 100644
--- a/libn3ds/kernel/include/internal/spinlock.h
+++ b/libn3ds/kernel/include/internal/spinlock.h
@@ -22,6 +22,11 @@
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
static inline void spinlockLock(u32 *lock)
{
u32 tmp;
@@ -43,3 +48,7 @@ static inline void spinlockUnlock(u32 *lock)
"sev"
: : "r" (0), "r" (lock) : "memory");
}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
\ No newline at end of file
diff --git a/libn3ds/kernel/include/internal/util.h b/libn3ds/kernel/include/internal/util.h
index 4b719ae..5de3309 100644
--- a/libn3ds/kernel/include/internal/util.h
+++ b/libn3ds/kernel/include/internal/util.h
@@ -19,5 +19,14 @@
*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
#define LIKELY(expr) __builtin_expect((expr), true)
#define UNLIKELY(expr) __builtin_expect((expr), false)
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
\ No newline at end of file
diff --git a/libn3ds/kernel/include/kernel.h b/libn3ds/kernel/include/kernel.h
index ec637ad..51ff275 100644
--- a/libn3ds/kernel/include/kernel.h
+++ b/libn3ds/kernel/include/kernel.h
@@ -75,4 +75,4 @@ void taskExit(void);
#ifdef __cplusplus
} // extern "C"
-#endif
+#endif
\ No newline at end of file
diff --git a/libn3ds/kernel/include/kevent.h b/libn3ds/kernel/include/kevent.h
index 74560fe..38fc15f 100644
--- a/libn3ds/kernel/include/kevent.h
+++ b/libn3ds/kernel/include/kevent.h
@@ -18,17 +18,15 @@
* along with this program. If not, see .
*/
-#include
#include "kernel.h"
+
#ifdef __cplusplus
extern "C"
{
#endif
-
-
/**
* @brief Creates a new kernel event.
*
@@ -82,4 +80,4 @@ void clearEvent(KHandle const kevent);
#ifdef __cplusplus
} // extern "C"
-#endif
+#endif
\ No newline at end of file
diff --git a/libn3ds/kernel/include/kmutex.h b/libn3ds/kernel/include/kmutex.h
index fcb000f..d1d5d69 100644
--- a/libn3ds/kernel/include/kmutex.h
+++ b/libn3ds/kernel/include/kmutex.h
@@ -21,6 +21,7 @@
#include "kernel.h"
+
#ifdef __cplusplus
extern "C"
{
@@ -28,8 +29,6 @@ extern "C"
// TODO: Implement this using semaphores?
-
-
/**
* @brief Creates a new kernel mutex.
*
@@ -65,4 +64,4 @@ KRes unlockMutex(KHandle const kmutex);
#ifdef __cplusplus
} // extern "C"
-#endif
+#endif
\ No newline at end of file
diff --git a/libn3ds/kernel/include/ksemaphore.h b/libn3ds/kernel/include/ksemaphore.h
index 10c2796..f08236c 100644
--- a/libn3ds/kernel/include/ksemaphore.h
+++ b/libn3ds/kernel/include/ksemaphore.h
@@ -19,17 +19,15 @@
*/
#include
-#include
#include "kernel.h"
+
#ifdef __cplusplus
extern "C"
{
#endif
-
-
/**
* @brief Creates a new kernel semaphore.
*
@@ -75,4 +73,4 @@ void signalSemaphore(KHandle const ksema, uint32_t signalCount, bool reschedule)
#ifdef __cplusplus
} // extern "C"
-#endif
+#endif
\ No newline at end of file
diff --git a/libn3ds/kernel/include/ktimer.h b/libn3ds/kernel/include/ktimer.h
index fa95ac3..6e5cf05 100644
--- a/libn3ds/kernel/include/ktimer.h
+++ b/libn3ds/kernel/include/ktimer.h
@@ -21,13 +21,12 @@
#include "kernel.h"
+
#ifdef __cplusplus
extern "C"
{
#endif
-
-
/*KHandle createTimer(bool pulse);
void deleteTimer(KHandle const ktimer);
@@ -40,4 +39,4 @@ KRes waitForTimer(KHandle const ktimer);*/
#ifdef __cplusplus
} // extern "C"
-#endif
+#endif
\ No newline at end of file
diff --git a/libn3ds/kernel/source/kevent.c b/libn3ds/kernel/source/kevent.c
index d3c0275..1642baa 100644
--- a/libn3ds/kernel/source/kevent.c
+++ b/libn3ds/kernel/source/kevent.c
@@ -16,7 +16,6 @@
* along with this program. If not, see .
*/
-#include
#include
#include "types.h"
#include "internal/list.h"
diff --git a/libn3ds/kernel/source/ksemaphore.c b/libn3ds/kernel/source/ksemaphore.c
index 40286cd..e2d19a7 100644
--- a/libn3ds/kernel/source/ksemaphore.c
+++ b/libn3ds/kernel/source/ksemaphore.c
@@ -16,7 +16,6 @@
* along with this program. If not, see .
*/
-#include
#include
#include "types.h"
#include "internal/list.h"
diff --git a/libn3ds/kernel/source/ktimer.c b/libn3ds/kernel/source/ktimer.c
index 1cd5972..ec06fdb 100644
--- a/libn3ds/kernel/source/ktimer.c
+++ b/libn3ds/kernel/source/ktimer.c
@@ -16,8 +16,7 @@
* along with this program. If not, see .
*/
-/*#include
-#include
+/*#include
#include "types.h"
#include "ktimer.h"
#include "internal/list.h"