From 1ce74e28ba8d6f91aca5830bfbc15897b68fcfac Mon Sep 17 00:00:00 2001 From: Keith Packard 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 --- 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