brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 1 | #ifndef _AOS_COMMON_MACROS_H_ |
| 2 | #define _AOS_COMMON_MACROS_H_ |
| 3 | |
| 4 | // This file has some common macros etc. |
| 5 | |
| 6 | // A macro to disallow the copy constructor and operator= functions |
| 7 | // This should be used in the private: declarations for a class |
| 8 | #define DISALLOW_COPY_AND_ASSIGN(TypeName) \ |
Brian Silverman | 08661c7 | 2013-09-01 17:24:38 -0700 | [diff] [blame] | 9 | TypeName(const TypeName&) = delete; \ |
| 10 | void operator=(const TypeName&) = delete |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 11 | // A macro to wrap arguments to macros that contain commas. |
| 12 | // Useful for DISALLOW_COPY_AND_ASSIGNing templated types with multiple template |
| 13 | // arguments. |
| 14 | #define MACRO_ARG(...) __VA_ARGS__ |
| 15 | // Double-wraps macro arguments. |
| 16 | // Necessary to use commas in gtest predicate arguments. |
| 17 | #define MACRO_DARG(...) (__VA_ARGS__) |
| 18 | |
| 19 | #ifdef __GNUC__ |
| 20 | #define UNUSED_VARIABLE __attribute__ ((unused)) |
| 21 | #else |
| 22 | #define UNUSED_VARIABLE |
| 23 | #endif |
| 24 | |
Brian Silverman | a7234c6 | 2014-03-24 20:23:25 -0700 | [diff] [blame] | 25 | #define STRINGIFY(x) TO_STRING(x) |
| 26 | #define TO_STRING(x) #x |
| 27 | |
Brian Silverman | f798614 | 2014-04-21 17:42:35 -0700 | [diff] [blame] | 28 | #ifdef __VXWORKS__ |
| 29 | // We're using ancient glibc, so sticking to just what the syscall can handle is |
| 30 | // probably safer. |
| 31 | #define GOOD_PRINTF_FORMAT_TYPE printf |
| 32 | #else |
Brian Silverman | 5bf41dc | 2014-04-21 18:31:45 -0700 | [diff] [blame^] | 33 | #ifdef __clang__ |
| 34 | #define GOOD_PRINTF_FORMAT_TYPE __printf__ |
| 35 | #else |
Brian Silverman | f798614 | 2014-04-21 17:42:35 -0700 | [diff] [blame] | 36 | #define GOOD_PRINTF_FORMAT_TYPE gnu_printf |
| 37 | #endif |
Brian Silverman | 5bf41dc | 2014-04-21 18:31:45 -0700 | [diff] [blame^] | 38 | #endif |
Brian Silverman | f798614 | 2014-04-21 17:42:35 -0700 | [diff] [blame] | 39 | |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 40 | #endif // _AOS_COMMON_MACROS_H_ |