agbabi icon indicating copy to clipboard operation
agbabi copied to clipboard

"#undef errno" breaks platforms with non-standard errno definitions

Open asiekierka opened this issue 9 months ago • 2 comments

For example, picolibc is compiled by default with thread-local storage enabled; while thread-local storage is of dubious usefulness for most GBA developers (Wonderful currently enables it to avoid building a separate world of packages like libstdc++ for the GBA alone), it makes the library less portable.

asiekierka avatar May 07 '24 18:05 asiekierka

Is there an errno API that could be used? Only reason it is used is to maintain POSIX API compliance

felixjones avatar May 10 '24 12:05 felixjones

Yes. It's in errno.h - including errno.h alone should do the trick. As per the C11 standard's final draft:

[...] errno, which expands to a modifiable lvalue that has type int and thread local storage duration, the value of which is set to a positive error number by several library functions.

asiekierka avatar Jun 18 '24 15:06 asiekierka