From 4427d8ac05cc36cddc285cda9caa73ca53fdba26 Mon Sep 17 00:00:00 2001
From: Rahix <rahix@rahix.de>
Date: Sun, 21 Jul 2019 17:27:12 +0200
Subject: [PATCH] fix(epicardium): Fix sphinx-doc errors

Signed-off-by: Rahix <rahix@rahix.de>
---
 Documentation/conf.py       |  1 +
 epicardium/epicardium.h     | 12 +++++++++++-
 epicardium/modules/stream.h |  8 +++++++-
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/Documentation/conf.py b/Documentation/conf.py
index 6f5ba2a5..0404784a 100644
--- a/Documentation/conf.py
+++ b/Documentation/conf.py
@@ -103,6 +103,7 @@ try:
     extensions.append("hawkmoth")
 
     cautodoc_root = os.path.abspath("..")
+    cautodoc_clang = "-D__SPHINX_DOC"
     has_hawkmoth = True
 except ImportError as e:
     if e.name == "clang":
diff --git a/epicardium/epicardium.h b/epicardium/epicardium.h
index 9add5750..c32120e8 100644
--- a/epicardium/epicardium.h
+++ b/epicardium/epicardium.h
@@ -1,14 +1,24 @@
 #ifndef _EPICARDIUM_H
 #define _EPICARDIUM_H
+
 #include <stdint.h>
-#include <stddef.h>
 #include <errno.h>
 
+#ifndef __SPHINX_DOC
+/* stddef.h is not recognized by hawkmoth for some odd reason */
+#include <stddef.h>
+#else
+typedef unsigned int size_t;
+#endif /* __SPHINX_DOC */
+
 /* clang-format off */
 #define API_INT_CTRL_C  1
 #define API_INT_BHI160  2
 #define API_INT_MAX     API_INT_BHI160
 
+/*
+ * These definitions are required for the code-generator.  Please don't touch!
+ */
 #ifndef API
 #define API(id, def) def
 #endif
diff --git a/epicardium/modules/stream.h b/epicardium/modules/stream.h
index 32c9e6e2..9d137a20 100644
--- a/epicardium/modules/stream.h
+++ b/epicardium/modules/stream.h
@@ -1,9 +1,15 @@
 #ifndef STREAM_H
 #define STREAM_H
 
-#include <stddef.h>
 #include <stdint.h>
 
+#ifndef __SPHINX_DOC
+/* stddef.h is not recognized by hawkmoth for some odd reason */
+#include <stddef.h>
+#else
+typedef unsigned int size_t;
+#endif /* __SPHINX_DOC */
+
 #include "FreeRTOS.h"
 #include "queue.h"
 
-- 
GitLab