Skip to content

Commit 6f601e2

Browse files
committed
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.
1 parent b55eb43 commit 6f601e2

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/debug/GdbStub.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
#ifndef _WIN32
1616
#include <sys/socket.h>
17+
#include <netinet/in.h>
1718
#include <fcntl.h>
1819
#include <poll.h>
1920
#include <signal.h>

src/fatfs/ffsystem.c

+5
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,13 @@
33
/* (C)ChaN, 2018 */
44
/*------------------------------------------------------------------------*/
55

6+
#ifdef _WIN32
7+
/* Windows will not define localtime_r for us unless we explicitly request it
8+
* with macros. */
69
#define _POSIX_SOURCE
710
#define _POSIX_THREAD_SAFE_FUNCTIONS
11+
#endif
12+
813
#include <time.h>
914

1015
#include "ff.h"

0 commit comments

Comments
 (0)