summaryrefslogtreecommitdiff
path: root/packages/picolibc/1.4.6/0000-libc-Create-a-macro-for-errno-so-that-GCC-tsystem.h-.patch
diff options
context:
space:
mode:
Diffstat (limited to 'packages/picolibc/1.4.6/0000-libc-Create-a-macro-for-errno-so-that-GCC-tsystem.h-.patch')
-rw-r--r--packages/picolibc/1.4.6/0000-libc-Create-a-macro-for-errno-so-that-GCC-tsystem.h-.patch33
1 files changed, 33 insertions, 0 deletions
diff --git a/packages/picolibc/1.4.6/0000-libc-Create-a-macro-for-errno-so-that-GCC-tsystem.h-.patch b/packages/picolibc/1.4.6/0000-libc-Create-a-macro-for-errno-so-that-GCC-tsystem.h-.patch
new file mode 100644
index 0000000..da26864
--- /dev/null
+++ b/packages/picolibc/1.4.6/0000-libc-Create-a-macro-for-errno-so-that-GCC-tsystem.h-.patch
@@ -0,0 +1,33 @@
+From 1ce74e28ba8d6f91aca5830bfbc15897b68fcfac Mon Sep 17 00:00:00 2001
+From: Keith Packard <keithp@keithp.com>
+Date: Sun, 16 Aug 2020 12:44:31 -0700
+Subject: [PATCH] libc: Create a macro for 'errno' so that GCC tsystem.h works
+
+GCC's tsystem.h adds a declaration for errno if it isn't a CPP symbol,
+which it isn't in picolibc as it's just a regular global (thread
+local) variable. Create a function macro with no arguments so that
+
+Signed-off-by: Keith Packard <keithp@keithp.com>
+---
+ newlib/libc/include/sys/errno.h | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/newlib/libc/include/sys/errno.h b/newlib/libc/include/sys/errno.h
+index 0da73f44e..64f179bc0 100644
+--- a/newlib/libc/include/sys/errno.h
++++ b/newlib/libc/include/sys/errno.h
+@@ -59,6 +59,11 @@ extern NEWLIB_THREAD_LOCAL_ERRNO int errno;
+
+ #define __errno_r(ptr) (errno)
+ #define __errno() (&errno)
++/*
++ * This lets applications check for #ifdef errno without requiring
++ * that errno be a parameter-less macro
++ */
++#define errno() (errno)
+
+ #define EPERM 1 /* Not owner */
+ #define ENOENT 2 /* No such file or directory */
+--
+2.28.0
+