John Park | 33858a3 | 2018-09-28 23:05:48 -0700 | [diff] [blame] | 1 | #ifndef _AOS_MACROS_H_ |
| 2 | #define _AOS_MACROS_H_ |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 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 |
Brian Silverman | 6da0427 | 2014-05-18 18:47:48 -0700 | [diff] [blame] | 11 | |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 12 | // A macro to wrap arguments to macros that contain commas. |
| 13 | // Useful for DISALLOW_COPY_AND_ASSIGNing templated types with multiple template |
| 14 | // arguments. |
| 15 | #define MACRO_ARG(...) __VA_ARGS__ |
| 16 | // Double-wraps macro arguments. |
| 17 | // Necessary to use commas in gtest predicate arguments. |
| 18 | #define MACRO_DARG(...) (__VA_ARGS__) |
| 19 | |
| 20 | #ifdef __GNUC__ |
| 21 | #define UNUSED_VARIABLE __attribute__ ((unused)) |
| 22 | #else |
| 23 | #define UNUSED_VARIABLE |
| 24 | #endif |
| 25 | |
Brian Silverman | a7234c6 | 2014-03-24 20:23:25 -0700 | [diff] [blame] | 26 | #define STRINGIFY(x) TO_STRING(x) |
| 27 | #define TO_STRING(x) #x |
| 28 | |
Brian Silverman | f798614 | 2014-04-21 17:42:35 -0700 | [diff] [blame] | 29 | #ifdef __VXWORKS__ |
| 30 | // We're using ancient glibc, so sticking to just what the syscall can handle is |
| 31 | // probably safer. |
| 32 | #define GOOD_PRINTF_FORMAT_TYPE printf |
| 33 | #else |
Brian Silverman | 5bf41dc | 2014-04-21 18:31:45 -0700 | [diff] [blame] | 34 | #ifdef __clang__ |
| 35 | #define GOOD_PRINTF_FORMAT_TYPE __printf__ |
| 36 | #else |
Brian Silverman | f798614 | 2014-04-21 17:42:35 -0700 | [diff] [blame] | 37 | #define GOOD_PRINTF_FORMAT_TYPE gnu_printf |
| 38 | #endif |
Brian Silverman | 5bf41dc | 2014-04-21 18:31:45 -0700 | [diff] [blame] | 39 | #endif |
Brian Silverman | f798614 | 2014-04-21 17:42:35 -0700 | [diff] [blame] | 40 | |
John Park | 33858a3 | 2018-09-28 23:05:48 -0700 | [diff] [blame] | 41 | #endif // _AOS_MACROS_H_ |