AP_Common: rearrange headers for consistency

Move attribute definitions all into AP_Common, rather than being split between two files

Remove unused SITL_printf macros

Stop AP_Common including board information

Include AP_Common.h in AP_HAL::Sempahore for WARN_IF_UNUSED; this was the cause of a circular import problem fixed by other commits in this patch.
This commit is contained in:
Peter Barker 2019-02-11 17:04:24 +11:00 committed by Peter Barker
parent e4e453402c
commit 7259f3fa2f
1 changed files with 14 additions and 11 deletions

View File

@ -20,7 +20,6 @@
#pragma once
#include <AP_HAL/AP_HAL_Boards.h>
#include <stdint.h>
#include <stdlib.h>
@ -53,6 +52,20 @@
# define FALLTHROUGH
#endif
#ifdef __GNUC__
#define WARN_IF_UNUSED __attribute__ ((warn_unused_result))
#else
#define WARN_IF_UNUSED
#endif
// use this to avoid issues between C++11 with NuttX and C++10 on
// other platforms.
#if !(defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L)
# define constexpr const
#endif
#define NORETURN __attribute__ ((noreturn))
#define ToRad(x) radians(x) // *pi/180
#define ToDeg(x) degrees(x) // *180/pi
@ -124,13 +137,3 @@ template<typename s, int t> struct assert_storage_size {
False otherwise.
*/
bool is_bounded_int32(int32_t value, int32_t lower_bound, int32_t upper_bound);
/*
useful debugging macro for SITL
*/
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL
#include <stdio.h>
#define SITL_printf(fmt, args ...) do { ::printf("%s(%u): " fmt, __FILE__, __LINE__, ##args); } while(0)
#else
#define SITL_printf(fmt, args ...)
#endif