Fix build for clang

Remove declaring _POSIX_SOURCE manually. Let the compiler take care of
this on its own, except on Windows where the compiler doesn't take care
of this. Additionally, include a missing header file for the definition
of struct sockaddr_in, which we need before we can allocate the struct.
With these fixes, we can build with Clang 18.1.5, although there are
many warnings.
This commit is contained in:
Jaeden Amero 2024-07-07 14:26:52 +00:00
parent a812a43bda
commit 5db9c0d508
2 changed files with 6 additions and 0 deletions

View File

@ -14,6 +14,7 @@
#ifndef _WIN32 #ifndef _WIN32
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h>
#include <fcntl.h> #include <fcntl.h>
#include <poll.h> #include <poll.h>
#include <signal.h> #include <signal.h>

View File

@ -3,8 +3,13 @@
/* (C)ChaN, 2018 */ /* (C)ChaN, 2018 */
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
#ifdef _WIN32
/* Windows will not define localtime_r for us unless we explicitly request it
* with macros. */
#define _POSIX_SOURCE #define _POSIX_SOURCE
#define _POSIX_THREAD_SAFE_FUNCTIONS #define _POSIX_THREAD_SAFE_FUNCTIONS
#endif
#include <time.h> #include <time.h>
#include "ff.h" #include "ff.h"