Yo James!
On Sat, 9 Apr 2022 12:19:09 -0700
James Browning <jamesb.fe80@gmail.com> wrote:
> There are no eternal guarantees. Tomorrow some will probably copy it
> to a wrong system and expect help.
> Today, it's me. Just as a toy, consider the following.
>
> $ head -n 50 splot.c
> #include <string.h>
>
> RET faux(int errnum, char *strerrbuf, size_t buflen) {
> return strerror_r(errnum, strerrbuf, buflen);
> }
> $ gcc -Werror -DRET="int" -c -o splot.{o,c}
> $ gcc -Werror -DRET="char *" -c -o splot.{o,c}
> splot.c:4:9: error: incompatible integer to pointer conversion
> returning 'int' from a function with result type 'char *'
> [-Werror,-Wint-conversion] return strerror_r(errnum, strerrbuf,
> buflen); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 1 error generated.
What libc?
I'm about to filing a bug report on this with musl.
libsystem on expired macOS. I intended for it to be a possible standard way to check function prototypes at compile time.
If the number of successful compiles is one the victor has the type, otherwise, someone is messing with you.
Dig out the logic probes and light stricks. I can occasionally file my own bug reports.