Android ndk-9c seems to be contradicting with the standards on the strerror_r
declaration.
Linux man pages show strerror_r
declarations as follows:
int strerror_r(int errnum, char *buf, size_t buflen);
/* XSI-compliant */
char *strerror_r(int errnum, char *buf, size_t buflen);
/* GNU-specific */
(from: http://linux.die.net/man/3/strerror_r)
And from the following post I understand that there is no proper way to undefine _GNU_SOURCE pragma, (_GNU_SOURCE seems to be defined internally and even if I somehow manage to undefine it I would get other kinds of errors.) which would normally force me to use the GNU-specific version.
why-is-gnu-source-defined-by-default-and-how-to-turn-it-off
The problem is that in android-ndk (version 9c) strerror_r is defined as follows
extern int strerror_r(int errnum, char *buf, size_t n);
(from: android-ndk-r9c\platforms\android-19\arch-arm\usr\include\string.h line:67)
So even though android ndk defines _GNU_SOURCE, declaration of strerror_r
contradict with it. So before I go and start introducing something like
if (defined(_GNU_SOURCE) && !defined(ANDROID))
to our cross platform project, I want to ask if there is a better way which would let me fix it without touching the code.(maybe some other switch in android that would make strerror_r
behave etc.)