blob: a2a78913c5cfa9a9f9f95f951cc9c08c1ba5469f [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
33#define GOOD_PRINTF_FORMAT_TYPE gnu_printf
34#endif
35
brians343bc112013-02-10 01:53:46 +000036#endif // _AOS_COMMON_MACROS_H_