diff --git a/src/modules/systemlib/perf_counter.c b/src/modules/systemlib/perf_counter.c index 227119df7d..07f51eacc4 100644 --- a/src/modules/systemlib/perf_counter.c +++ b/src/modules/systemlib/perf_counter.c @@ -294,7 +294,7 @@ perf_end(perf_counter_t handle) } } -#include +#include "systemlib/err.h" void perf_set_elapsed(perf_counter_t handle, int64_t elapsed) diff --git a/src/modules/systemlib/perf_counter.h b/src/modules/systemlib/perf_counter.h index f4669f172f..ced816e76a 100644 --- a/src/modules/systemlib/perf_counter.h +++ b/src/modules/systemlib/perf_counter.h @@ -64,7 +64,9 @@ __BEGIN_DECLS * @return Handle for the new counter, or NULL if a counter * could not be allocated. */ +#ifndef perf_alloc // perf_alloc might be defined to be NULL in src/modules/px4iofirmware/px4io.h __EXPORT extern perf_counter_t perf_alloc(enum perf_counter_type type, const char *name); +#endif /** * Get the reference to an existing counter or create a new one if it does not exist. diff --git a/src/platforms/posix/include/queue.h b/src/platforms/posix/include/queue.h index 30dc264f3f..d6315ca172 100644 --- a/src/platforms/posix/include/queue.h +++ b/src/platforms/posix/include/queue.h @@ -42,6 +42,12 @@ #include +#ifdef __cplusplus +#include // NULL +#else +#include // NULL +#endif + /************************************************************************ * Pre-processor Definitions ************************************************************************/ @@ -61,9 +67,6 @@ // Required for Linux #define FAR -#ifndef NULL -#define NULL (void *)0 -#endif /************************************************************************ * Global Type Declarations diff --git a/src/platforms/posix/px4_layer/drv_hrt.c b/src/platforms/posix/px4_layer/drv_hrt.c index 8f7b99592d..4f9b4e824c 100644 --- a/src/platforms/posix/px4_layer/drv_hrt.c +++ b/src/platforms/posix/px4_layer/drv_hrt.c @@ -94,7 +94,6 @@ static void hrt_unlock(void) } #if defined(__PX4_APPLE_LEGACY) -#include #include int px4_clock_gettime(clockid_t clk_id, struct timespec *tp) diff --git a/src/platforms/posix/work_queue/hrt_work_cancel.c b/src/platforms/posix/work_queue/hrt_work_cancel.c index d8c5957c0b..a1af842ca5 100644 --- a/src/platforms/posix/work_queue/hrt_work_cancel.c +++ b/src/platforms/posix/work_queue/hrt_work_cancel.c @@ -39,8 +39,8 @@ #include #include -#include #include + #include "hrt_work.h" /**************************************************************************** diff --git a/src/platforms/qurt/include/queue.h b/src/platforms/qurt/include/queue.h index 30dc264f3f..d6315ca172 100644 --- a/src/platforms/qurt/include/queue.h +++ b/src/platforms/qurt/include/queue.h @@ -42,6 +42,12 @@ #include +#ifdef __cplusplus +#include // NULL +#else +#include // NULL +#endif + /************************************************************************ * Pre-processor Definitions ************************************************************************/ @@ -61,9 +67,6 @@ // Required for Linux #define FAR -#ifndef NULL -#define NULL (void *)0 -#endif /************************************************************************ * Global Type Declarations diff --git a/src/platforms/qurt/px4_layer/drv_hrt.c b/src/platforms/qurt/px4_layer/drv_hrt.c index bdc49da74a..3ca4cbfe9c 100644 --- a/src/platforms/qurt/px4_layer/drv_hrt.c +++ b/src/platforms/qurt/px4_layer/drv_hrt.c @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -63,8 +64,6 @@ static void hrt_call_reschedule(void); static sem_t _hrt_lock; static struct work_s _hrt_work; -#include -#include #define CLOCK_REALTIME 0 #ifndef CLOCK_MONOTONIC