blob: 9f8a3682f9daf72f0c23dd315c88b957f355a94b [file] [log] [blame]
John Park33858a32018-09-28 23:05:48 -07001#ifndef _AOS_MACROS_H_
2#define _AOS_MACROS_H_
brians343bc112013-02-10 01:53:46 +00003
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
Brian Silverman6da04272014-05-18 18:47:48 -070011
brians343bc112013-02-10 01:53:46 +000012// 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 Silvermana7234c62014-03-24 20:23:25 -070026#define STRINGIFY(x) TO_STRING(x)
27#define TO_STRING(x) #x
28
Brian Silvermanf7986142014-04-21 17:42:35 -070029#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 Silverman5bf41dc2014-04-21 18:31:45 -070034#ifdef __clang__
35#define GOOD_PRINTF_FORMAT_TYPE __printf__
36#else
Brian Silvermanf7986142014-04-21 17:42:35 -070037#define GOOD_PRINTF_FORMAT_TYPE gnu_printf
38#endif
Brian Silverman5bf41dc2014-04-21 18:31:45 -070039#endif
Brian Silvermanf7986142014-04-21 17:42:35 -070040
John Park33858a32018-09-28 23:05:48 -070041#endif // _AOS_MACROS_H_