blob: 21482f67baefffdf86b2084d6b1c56567a193ee3 [file] [log] [blame]
brians343bc112013-02-10 01:53:46 +00001#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 Silverman08661c72013-09-01 17:24:38 -07009 TypeName(const TypeName&) = delete; \
10 void operator=(const TypeName&) = delete
brians343bc112013-02-10 01:53:46 +000011// 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 Silvermana7234c62014-03-24 20:23:25 -070025#define STRINGIFY(x) TO_STRING(x)
26#define TO_STRING(x) #x
27
Brian Silvermanf7986142014-04-21 17:42:35 -070028#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 Silverman5bf41dc2014-04-21 18:31:45 -070033#ifdef __clang__
34#define GOOD_PRINTF_FORMAT_TYPE __printf__
35#else
Brian Silvermanf7986142014-04-21 17:42:35 -070036#define GOOD_PRINTF_FORMAT_TYPE gnu_printf
37#endif
Brian Silverman5bf41dc2014-04-21 18:31:45 -070038#endif
Brian Silvermanf7986142014-04-21 17:42:35 -070039
brians343bc112013-02-10 01:53:46 +000040#endif // _AOS_COMMON_MACROS_H_