common_macros.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 #ifndef LASS_GUARDIAN_OF_INCLUSION_UTIL_MACRO_H
00052 #define LASS_GUARDIAN_OF_INCLUSION_UTIL_MACRO_H
00053
00054
00055 #define LASS_WRAP(x) x
00056
00057
00058
00059
00060
00061
00062 #define LASS_STRINGIFY(iA) LASS_STRINGIFY_IMPL(iA)
00063 #define LASS_STRINGIFY_IMPL(iA) #iA
00064
00065
00066
00067
00068 #define LASS_CONCATENATE( iA, iB ) LASS_CONCATENATE_IMPL(iA, iB)
00069 #define LASS_CONCATENATE_IMPL( iA, iB ) iA##iB
00070
00071
00072
00073
00074 #define LASS_CONCATENATE_3( iA, iB, iC ) LASS_CONCATENATE_3_IMPL(iA, iB, iC)
00075 #define LASS_CONCATENATE_3_IMPL( iA, iB, iC ) iA##iB##iC
00076
00077
00078
00079
00080 #if LASS_COMPILER_TYPE == LASS_COMPILER_TYPE_GCC
00081 # define LASS_BREAK_HERE __asm__("int3")
00082 #else
00083 # if defined(_WIN64)
00084 # define LASS_BREAK_HERE __debugbreak();
00085 # else
00086 # define LASS_BREAK_HERE __asm { int 3 }
00087 # endif
00088 #endif
00089
00090
00091
00092
00093 #define LASS_UNIQUENAME( iPrefix ) LASS_CONCATENATE(iPrefix,LASS_LINE)
00094
00095
00096
00097
00098
00099
00100
00101
00102 #define LASS_FILE __FILE__
00103
00104
00105
00106
00107 #define LASS_LINE __LINE__
00108
00109 #define LASS_HERE LASS_FILE "(" LASS_STRINGIFY(LASS_LINE) ")"
00110
00111
00112
00113
00114 #ifdef __FUNCTION__
00115 # define LASS_FUNCTION __FUNCTION__
00116 # define LASS_PRETTY_FUNCTION LASS_FUNCTION
00117 #else
00118 # define LASS_FUNCTION "??"
00119 # define LASS_PRETTY_FUNCTION LASS_HERE
00120 #endif
00121
00122
00123
00124
00125
00126
00127 #include "common_macros.inl"
00128
00129 #if !defined(NDEBUG)
00130 # define LASS_ASSERT( iExpression ) LASS_ASSERT_IMPL( iExpression )
00131 # define LASS_ASSERT_UNREACHABLE LASS_ASSERT_UNREACHABLE_IMPL
00132 # define LASS_WARNING( iMessage ) LASS_WARNING_IMPL( iMessage )
00133 # define LASS_WARNING_ONCE_EX( iMessage, iUniqueName ) LASS_WARNING_ONCE_IMPL( iMessage, LASS_UNIQUENAME(iUniqueName) )
00134 # define LASS_WARNING_ONCE( iMessage ) LASS_WARNING_ONCE_EX( iMessage, lassWarnOnce )
00135 # define LASS_EVAL( iExpression ) LASS_EVAL_IMPL( iExpression )
00136 # define LASS_LOG( iMessage ) LASS_LOG_IMPL( iMessage )
00137 #else
00138 # define LASS_ASSERT( iExpression )
00139 # define LASS_ASSERT_UNREACHABLE
00140 # define LASS_WARNING( iMessage ) LASS_WARNING_IMPL( iMessage )
00141 # define LASS_WARNING_ONCE_EX( iMessage, iUniqueName ) LASS_WARNING_ONCE_IMPL( iMessage, LASS_UNIQUENAME(iUniqueName) )
00142 # define LASS_WARNING_ONCE( iMessage ) LASS_WARNING_ONCE_EX( iMessage, lassWarnOnce )
00143 # define LASS_EVAL( iExpression ) LASS_EVAL_IMPL( iExpression )
00144 # define LASS_LOG( iMessage ) LASS_LOG_IMPL( iMessage )
00145 #endif
00146
00147
00148
00149
00150
00151 #define LASS_EXECUTE_BEFORE_MAIN( x ) LASS_EXECUTE_BEFORE_MAIN_EX(lassDummyName, x)
00152
00153
00154
00155
00156
00157 #define LASS_EXECUTE_BEFORE_MAIN_EX( iPrefix, x ) \
00158 namespace \
00159 { \
00160 inline bool LASS_CONCATENATE( LASS_UNIQUENAME(iPrefix),func ) () \
00161 { \
00162 x \
00163 return true; \
00164 } \
00165 const bool LASS_CONCATENATE( LASS_UNIQUENAME(iPrefix),var ) = \
00166 LASS_CONCATENATE( LASS_UNIQUENAME(iPrefix),func ) (); \
00167 }
00168
00169
00170
00171
00172
00173
00174
00175 #define LASS_NOTE( iMessage )\
00176 message(LASS_FILE "(" LASS_STRINGIFY(LASS_LINE) "):\n[LASS BUILD MSG] " iMessage)
00177
00178
00179
00180
00181
00182 #define LASS_TODO( iMessage )\
00183 message(LASS_FILE "(" LASS_STRINGIFY(LASS_LINE) "):\n[LASS BUILD MSG] *** TODO: " iMessage " ***")
00184
00185
00186
00187
00188 #define LASS_FIXME( iMessage )\
00189 message(LASS_FILE "(" LASS_STRINGIFY(LASS_LINE) "):\n[LASS BUILD MSG] *** FIXME: " iMessage " ***")
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206 #if LASS_COMPILER_TYPE == LASS_COMPILER_TYPE_GCC
00207 # define LASS_UNUSED(x) x __attribute__((unused))
00208 #else
00209 # define LASS_UNUSED(x) x
00210 #endif
00211
00212 #endif