summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSiZiOUS <sizious@gmail.com>2025-07-19 18:45:42 +0200
committerDamien George <damien@micropython.org>2025-08-01 12:01:37 +1000
commitf67a3703118be7d97629130d99630996ff3cb255 (patch)
treea01c1e2d7eac74f2d4f76bcc3b648d0c0fe58cab
parentf8f6d71940cb34c762d919a255f084d18fbcf1c1 (diff)
embed/port: Fix alloca include for Windows platforms.
When building the embedded port on MinGW-w64, I receive the following error: fatal error: alloca.h: No such file or directory MinGW-w64 (used on MSYS2) doesn't include `alloca.h`, but `alloca()` is provided via `malloc.h` instead. And this fix is also needed for other Windows build systems. Signed-off-by: SiZiOUS <sizious@gmail.com>
-rw-r--r--ports/embed/port/mpconfigport_common.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/ports/embed/port/mpconfigport_common.h b/ports/embed/port/mpconfigport_common.h
index 8e19859ed..aa65640fc 100644
--- a/ports/embed/port/mpconfigport_common.h
+++ b/ports/embed/port/mpconfigport_common.h
@@ -34,8 +34,13 @@ typedef long mp_off_t;
// Need to provide a declaration/definition of alloca()
#if defined(__FreeBSD__) || defined(__NetBSD__)
+// BSD
#include <stdlib.h>
+#elif defined(_WIN32)
+// Windows
+#include <malloc.h>
#else
+// Other OS
#include <alloca.h>
#endif