Fix -Wimplicit-function-declaration errors with musl and gcc 14. ``` In file included from ../desmume/src/libretro-common/include/rthreads/rthreads.h:31, from ../desmume/src/libretro-common/rthreads/async_job.c:25: ../desmume/src/libretro-common/include/retro_miscellaneous.h: In function 'retro_sleep': ../desmume/src/libretro-common/include/retro_miscellaneous.h:107:4: error: implicit declaration of function 'nanosleep' [-Wimplicit-func tion-declaration] 107 | nanosleep(&tv, NULL); | ^~~~~~~~~ ``` ``` ../desmume/src/libretro-common/file/file_path.c: In function 'path_mkdir': ../desmume/src/libretro-common/file/file_path.c:53:24: error: implicit declaration of function 'strdup'; did you mean 'strcmp'? [-Wimpli cit-function-declaration] 53 | char *basedir = strdup(dir); | ^~~~~~ | strcmp ../desmume/src/libretro-common/file/file_path.c:53:24: error: initialization of 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion] ../desmume/src/libretro-common/file/file_path.c: In function 'path_resolve_realpath': ../desmume/src/libretro-common/file/file_path.c:541:9: error: implicit declaration of function 'realpath' [-Wimplicit-function-declarati on] 541 | if (!realpath(tmp, buf)) | ^~~~~~~~ ``` --- desmume-0.9.13-origin/desmume/src/libretro-common/file/file_path.c +++ desmume-0.9.13/desmume/src/libretro-common/file/file_path.c @@ -20,8 +20,16 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/* stdlib.h realpath() */ +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif #include #include +/* string.h strdup() */ +#ifndef _POSIX_C_SOURCE +#define _POSIX_C_SOURCE 199309L +#endif #include #include #include --- desmume-0.9.13-origin/desmume/src/libretro-common/include/retro_miscellaneous.h +++ desmume-0.9.13/desmume/src/libretro-common/include/retro_miscellaneous.h @@ -39,6 +39,10 @@ #elif defined(_3DS) #include <3ds.h> #else +/* time.h nanosleep() */ +#ifndef _POSIX_C_SOURCE +#define _POSIX_C_SOURCE 199309L +#endif #include #endif