diff --git a/src/command.c b/src/command.c index 5d6dfc682a0..1e44bbd5d1d 100644 --- a/src/command.c +++ b/src/command.c @@ -46,12 +46,6 @@ #include "traceswo.h" #endif -#if defined(_WIN32) -#include -#else -#include -#endif - static bool cmd_version(target_s *t, int argc, const char **argv); static bool cmd_help(target_s *t, int argc, const char **argv); diff --git a/src/gdb_main.c b/src/gdb_main.c index 62fb78784c3..68f89bc0a75 100644 --- a/src/gdb_main.c +++ b/src/gdb_main.c @@ -55,11 +55,6 @@ #define GDB_QSUPPORTED_NOACKMODE #endif -#if defined(_WIN32) -#include -#else -#include -#endif #include typedef enum gdb_signal { diff --git a/src/include/general.h b/src/include/general.h index 6df94b1dc87..e4c0093924c 100644 --- a/src/include/general.h +++ b/src/include/general.h @@ -35,7 +35,8 @@ #endif #if defined(_WIN32) || defined(__CYGWIN__) #include -#else +/* `alloca()` on FreeBSD is visible from , and does not exist */ +#elif !defined(__FreeBSD__) #include #endif #include diff --git a/src/platforms/hosted/Makefile.inc b/src/platforms/hosted/Makefile.inc index 4247fc04732..9a3c4b632f8 100644 --- a/src/platforms/hosted/Makefile.inc +++ b/src/platforms/hosted/Makefile.inc @@ -44,6 +44,10 @@ HIDAPILIB = hidapi ifneq (,$(findstring linux,$(SYS))) SRC += serial_unix.c HIDAPILIB = hidapi-hidraw +else ifneq (,$(findstring freebsd,$(SYS))) + # On FreeBSD, only the hidapi on libusb-1.0 variant exists + SRC += serial_unix.c + HIDAPILIB = hidapi else ifneq (,$(findstring mingw,$(SYS))) FLAVOUR = $(shell which $(CC)) ifneq (,$(findstring ucrt64,$(FLAVOUR))) diff --git a/src/target/cortexm.c b/src/target/cortexm.c index aa7334b2988..3bb1ea8b275 100644 --- a/src/target/cortexm.c +++ b/src/target/cortexm.c @@ -45,11 +45,6 @@ #include #include -#if defined(_WIN32) || defined(__CYGWIN__) -#include -#else -#include -#endif #include #include #include