AP_HAL: added AP_HAL_Macros.h

this adds a define for constexpr, allowing code to build either with
or without -std=gnu++0x
This commit is contained in:
Andrew Tridgell 2013-01-16 09:12:55 +11:00
parent 53ea7c564e
commit 2ce18f588b
2 changed files with 21 additions and 6 deletions

View File

@ -7,12 +7,7 @@
#include "AP_HAL_Namespace.h"
#include "AP_HAL_Boards.h"
#ifdef __GNUC__
#define WARN_IF_UNUSED __attribute__ ((warn_unused_result))
#else
#define WARN_IF_UNUSED
#endif
#include "AP_HAL_Macros.h"
/* HAL Module Classes (all pure virtual) */
#include "UARTDriver.h"

View File

@ -0,0 +1,20 @@
#ifndef __AP_HAL_MACROS_H__
#define __AP_HAL_MACROS_H__
/*
macros to allow code to build on multiple platforms more easily
*/
#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
#endif // __AP_HAL_MACROS_H__