| 1 |
`**********************************************************************` |
| 2 |
`* This is an include template file for the tracewpp preprocessor. *` |
| 3 |
`* *` |
| 4 |
`* Copyright (c) Microsoft Corporation. All rights reserved. *` |
| 5 |
`**********************************************************************` |
| 6 |
// template `TemplateFile` |
| 7 |
|
| 8 |
// This template expects: |
| 9 |
// WPP_THIS_FILE defined (see header.tpl) |
| 10 |
// WPP_LOGGER_ARG defined |
| 11 |
// WPP_GET_LOGGER defined |
| 12 |
// WPP_ENABLED() defined |
| 13 |
|
| 14 |
#ifdef __cplusplus |
| 15 |
extern "C" { |
| 16 |
#endif |
| 17 |
|
| 18 |
#ifdef WPP_ALREADY_INCLUDED |
| 19 |
|
| 20 |
#undef WPP_LOCAL_TraceGuids |
| 21 |
#undef WPP_INVOKE_WPP_DEBUG |
| 22 |
|
| 23 |
#else // WPP_ALREADY_INCLUDED |
| 24 |
|
| 25 |
#ifndef NO_CHECK_FOR_NULL_STRING |
| 26 |
#ifndef WPP_CHECK_FOR_NULL_STRING |
| 27 |
#define WPP_CHECK_FOR_NULL_STRING |
| 28 |
#endif |
| 29 |
#endif // NO_CHECK_FOR_NULL_STRING |
| 30 |
|
| 31 |
#define WPP_FLATTEN(...) __VA_ARGS__ |
| 32 |
#define WPP_GLUE5(a, b, c, d, e) a ## b ## c ## d ## e |
| 33 |
#define WPP_XGLUE5(a, b, c, d, e) WPP_GLUE5(a, b, c, d, e) |
| 34 |
#define WPP_(Id) WPP_XGLUE5(WPP_, Id, _, WPP_THIS_FILE, __LINE__) |
| 35 |
|
| 36 |
#ifndef WPP_INLINE |
| 37 |
#define WPP_INLINE DECLSPEC_NOINLINE __inline |
| 38 |
#endif |
| 39 |
|
| 40 |
#ifndef WPP_FORCEINLINE |
| 41 |
#define WPP_FORCEINLINE __forceinline |
| 42 |
#endif |
| 43 |
|
| 44 |
#endif // WPP_ALREADY_INCLUDED |
| 45 |
|
| 46 |
#ifdef WPP_NO_ANNOTATIONS |
| 47 |
|
| 48 |
#define WPP_ANNOTATE(x) |
| 49 |
|
| 50 |
#else // WPP_NO_ANNOTATIONS |
| 51 |
|
| 52 |
`FORALL Msg IN Messages WHERE MsgIsPrivate` |
| 53 |
#ifdef WPP_PUBLIC_`Msg.FlagValue` |
| 54 |
#define WPP_PUBLIC_ANNOT_`Msg.Name` |
| 55 |
#endif |
| 56 |
`ENDFOR` |
| 57 |
`FORALL Msg IN Messages WHERE MsgIsPublic` |
| 58 |
#define WPP_PUBLIC_ANNOT_`Msg.Name` |
| 59 |
`ENDFOR` |
| 60 |
#ifdef WPP_EMIT_FUNC_NAME |
| 61 |
#define WPP_FUNC_NAME L" FUNC=" _WPPW(__FUNCTION__) |
| 62 |
#else // WPP_EMIT_FUNC_NAME |
| 63 |
#define WPP_FUNC_NAME |
| 64 |
#endif // WPP_EMIT_FUNC_NAME |
| 65 |
`FORALL Msg IN Messages` |
| 66 |
|
| 67 |
#ifdef WPP_USER_MSG_GUID |
| 68 |
# define WPP_ANNOTATE_`Msg.Name`_FINAL(P, File, Name, ...) __annotation( \ |
| 69 |
L ## P, \ |
| 70 |
WPP_GUID_WTEXT WPP_USER_MSG_GUID L"`CurrentDir` // SRC=" _WPPW(File) \ |
| 71 |
L" MJ=`ENV MAJORCOMP` MN=`ENV MINORCOMP`", \ |
| 72 |
L"#typev " _WPPW(Name) \ |
| 73 |
L" `Msg.MsgNo` \"`Msg.Text`\" // `Msg.Indent` `Msg.GooPairs`" \ |
| 74 |
WPP_FUNC_NAME, \ |
| 75 |
__VA_ARGS__) |
| 76 |
#else // WPP_USER_MSG_GUID |
| 77 |
# define WPP_ANNOTATE_`Msg.Name`_FINAL(P, File, Name, ...) __annotation( \ |
| 78 |
L ## P, \ |
| 79 |
L"`Msg.Guid` `CurrentDir` // SRC=" _WPPW(File) \ |
| 80 |
L" MJ=`ENV MAJORCOMP` MN=`ENV MINORCOMP`", \ |
| 81 |
L"#typev " _WPPW(Name) \ |
| 82 |
L" `Msg.MsgNo` \"`Msg.Text`\" // `Msg.Indent` `Msg.GooPairs`" \ |
| 83 |
WPP_FUNC_NAME, \ |
| 84 |
__VA_ARGS__) |
| 85 |
#endif // WPP_USER_MSG_GUID |
| 86 |
|
| 87 |
#ifdef WPP_PUBLIC_ANNOT_`Msg.Name` |
| 88 |
# define WPP_ANNOTATE_`Msg.Name` WPP_ANNOTATE_`Msg.Name`_FINAL( \ |
| 89 |
"TMF:", \ |
| 90 |
"Unknown_cxx00", \ |
| 91 |
"Unknown_cxx00", \ |
| 92 |
L"{"`FORALL Arg IN Msg.Arguments`, \ |
| 93 |
L"Arg, `Arg.MofType` -- `Arg.No`" `ENDFOR Arg`, \ |
| 94 |
L"}", \ |
| 95 |
L"PUBLIC_TMF:") |
| 96 |
# ifndef WPP_PUBLIC_TMC |
| 97 |
# define WPP_PUBLIC_TMC // Adds "PUBLIC_TMF:" to the control guid annotation |
| 98 |
# endif |
| 99 |
#else // WPP_PUBLIC_ANNOT_`Msg.Name` |
| 100 |
# define WPP_ANNOTATE_`Msg.Name` WPP_ANNOTATE_`Msg.Name`_FINAL( \ |
| 101 |
"TMF:", \ |
| 102 |
"`SourceFile.Name`", \ |
| 103 |
"`Msg.Name`", \ |
| 104 |
L"{"`FORALL Arg IN Msg.Arguments`, \ |
| 105 |
L"`Arg.Name`, `Arg.MofType` -- `Arg.No`" `ENDFOR Arg`, \ |
| 106 |
L"}") |
| 107 |
#endif // WPP_PUBLIC_ANNOT_`Msg.Name` |
| 108 |
`ENDFOR` |
| 109 |
|
| 110 |
# define WPP_ANNOTATE(x) WPP_ANNOTATE_ ## x, |
| 111 |
|
| 112 |
#endif // WPP_NO_ANNOTATIONS |
| 113 |
`IF TraceGuids !Empty` |
| 114 |
|
| 115 |
#ifdef WPP_USER_MSG_GUID |
| 116 |
|
| 117 |
#define WPP_LOCAL_MSG_VAR(Guid) WPP_XGLUE3(WPP_, WPP_GUID_NORM Guid, _Traceguids) |
| 118 |
|
| 119 |
#define WPP_LOCAL_MSG_GUID(Guid) \ |
| 120 |
extern const __declspec(selectany) GUID WPP_LOCAL_MSG_VAR(Guid)[] = { WPP_GUID_STRUCT Guid } |
| 121 |
|
| 122 |
WPP_LOCAL_MSG_GUID(WPP_USER_MSG_GUID); |
| 123 |
#define WPP_LOCAL_TraceGuids WPP_LOCAL_MSG_VAR(WPP_USER_MSG_GUID) |
| 124 |
|
| 125 |
#else // WPP_USER_MSG_GUID |
| 126 |
|
| 127 |
#define WPP_LOCAL_TraceGuids WPP_`FORALL Guid IN TraceGuids``Guid.Normalized`_`ENDFOR`Traceguids |
| 128 |
extern const __declspec(selectany) GUID WPP_LOCAL_TraceGuids[] = {`FORALL Guid IN TraceGuids` `Guid.Struct`, `ENDFOR`}; |
| 129 |
|
| 130 |
#endif // WPP_USER_MSG_GUID |
| 131 |
`ENDIF TraceGuids !Empty` |
| 132 |
|
| 133 |
#ifndef WPP_ALREADY_INCLUDED |
| 134 |
|
| 135 |
#ifndef WPP_TRACE_OPTIONS |
| 136 |
enum { WPP_TRACE_OPTIONS = |
| 137 |
TRACE_MESSAGE_SEQUENCE | |
| 138 |
TRACE_MESSAGE_GUID | |
| 139 |
TRACE_MESSAGE_SYSTEMINFO | |
| 140 |
TRACE_MESSAGE_TIMESTAMP }; |
| 141 |
#endif // WPP_TRACE_OPTIONS |
| 142 |
|
| 143 |
#ifndef WPP_LOGPAIR_SEPARATOR |
| 144 |
# define WPP_LOGPAIR_SEPARATOR , |
| 145 |
#endif |
| 146 |
#ifndef WPP_LOGPAIR_SIZET |
| 147 |
# define WPP_LOGPAIR_SIZET SIZE_T |
| 148 |
#endif |
| 149 |
#ifndef WPP_LOGPAIR |
| 150 |
# define WPP_LOGPAIR(_Size, _Addr) (_Addr),((WPP_LOGPAIR_SIZET)(_Size))WPP_LOGPAIR_SEPARATOR |
| 151 |
#endif |
| 152 |
|
| 153 |
#define WPP_LOGTYPEVAL(_Type, _Value) WPP_LOGPAIR(sizeof(_Type), &(_Value)) |
| 154 |
#define WPP_LOGTYPEPTR(_Value) WPP_LOGPAIR(sizeof(*(_Value)), (_Value)) |
| 155 |
|
| 156 |
// Marshalling macros. |
| 157 |
|
| 158 |
#ifndef WPP_LOGASTR |
| 159 |
# ifdef WPP_CHECK_FOR_NULL_STRING |
| 160 |
# define WPP_LOGASTR(_value) WPP_LOGPAIR( \ |
| 161 |
(_value) ? strlen(_value) + 1 : 5, \ |
| 162 |
(_value) ? (_value) : "NULL" ) |
| 163 |
# else // WPP_CHECK_FOR_NULL_STRING |
| 164 |
# define WPP_LOGASTR(_value) WPP_LOGPAIR( \ |
| 165 |
strlen(_value) + 1, \ |
| 166 |
_value ) |
| 167 |
# endif // WPP_CHECK_FOR_NULL_STRING |
| 168 |
#endif // WPP_LOGASTR |
| 169 |
|
| 170 |
#ifndef WPP_LOGWSTR |
| 171 |
# ifdef WPP_CHECK_FOR_NULL_STRING |
| 172 |
# define WPP_LOGWSTR(_value) WPP_LOGPAIR( \ |
| 173 |
((_value) ? wcslen(_value) + 1 : 5) * sizeof(WCHAR), \ |
| 174 |
(_value) ? (_value) : L"NULL" ) |
| 175 |
# else // WPP_CHECK_FOR_NULL_STRING |
| 176 |
# define WPP_LOGWSTR(_value) WPP_LOGPAIR( \ |
| 177 |
(wcslen(_value) + 1) * sizeof(WCHAR), \ |
| 178 |
_value ) |
| 179 |
# endif // WPP_CHECK_FOR_NULL_STRING |
| 180 |
#endif // WPP_LOGWSTR |
| 181 |
|
| 182 |
#ifndef WPP_LOGPGUID |
| 183 |
# define WPP_LOGPGUID(_value) WPP_LOGPAIR( sizeof(GUID), (_value) ) |
| 184 |
#endif // WPP_LOGPGUID |
| 185 |
|
| 186 |
#ifndef WPP_LOGPSID |
| 187 |
# ifdef WPP_CHECK_FOR_NULL_STRING |
| 188 |
# define WPP_LOGPSID(_value) WPP_LOGPAIR( \ |
| 189 |
(_value) && WPP_IsValidSid(_value) ? WPP_GetLengthSid(_value) : 5, \ |
| 190 |
(_value) && WPP_IsValidSid(_value) ? (_value) : (void const*)"NULL") |
| 191 |
# else // WPP_CHECK_FOR_NULL_STRING |
| 192 |
# define WPP_LOGPSID(_value) WPP_LOGPAIR( \ |
| 193 |
WPP_GetLengthSid(_value), \ |
| 194 |
(_value) ) |
| 195 |
#endif // WPP_CHECK_FOR_NULL_STRING |
| 196 |
#endif // WPP_LOGPSID |
| 197 |
|
| 198 |
#ifndef WPP_LOGCSTR |
| 199 |
# define WPP_LOGCSTR(_x) \ |
| 200 |
WPP_LOGPAIR( sizeof(USHORT), &(_x).Length ) \ |
| 201 |
WPP_LOGPAIR( (USHORT)(_x).Length, (USHORT)(_x).Length ? (_x).Buffer : "" ) |
| 202 |
#endif // WPP_LOGCSTR |
| 203 |
|
| 204 |
#ifndef WPP_LOGUSTR |
| 205 |
# define WPP_LOGUSTR(_x) \ |
| 206 |
WPP_LOGPAIR( sizeof(USHORT), &(_x).Length ) \ |
| 207 |
WPP_LOGPAIR( (USHORT)(_x).Length, (USHORT)(_x).Length ? (_x).Buffer : L"" ) |
| 208 |
#endif // WPP_LOGUSTR |
| 209 |
|
| 210 |
#ifndef WPP_LOGPUSTR |
| 211 |
#ifdef WPP_CHECK_FOR_NULL_STRING |
| 212 |
# define WPP_LOGPUSTR(_x) \ |
| 213 |
WPP_LOGPAIR( \ |
| 214 |
sizeof(USHORT), \ |
| 215 |
(_x) ? &(_x)->Length : (void const*)L"\x08" ) \ |
| 216 |
WPP_LOGPAIR( \ |
| 217 |
(_x) ? (USHORT)(_x)->Length : 0x08, \ |
| 218 |
(_x) && (USHORT)(_x)->Length ? (_x)->Buffer : L"NULL" ) |
| 219 |
#else // WPP_CHECK_FOR_NULL_STRING |
| 220 |
# define WPP_LOGPUSTR(_x) WPP_LOGUSTR(*(_x)) |
| 221 |
#endif // WPP_CHECK_FOR_NULL_STRING |
| 222 |
#endif // WPP_LOGPUSTR |
| 223 |
|
| 224 |
#ifndef WPP_LOGPCSTR |
| 225 |
#ifdef WPP_CHECK_FOR_NULL_STRING |
| 226 |
# define WPP_LOGPCSTR(_x) \ |
| 227 |
WPP_LOGPAIR( \ |
| 228 |
sizeof(USHORT), \ |
| 229 |
(_x) ? &(_x)->Length : (void const*)L"\x04" ) \ |
| 230 |
WPP_LOGPAIR( \ |
| 231 |
(_x) ? (USHORT)(_x)->Length : 0x04, \ |
| 232 |
(_x) && (USHORT)(_x)->Length ? (_x)->Buffer : "NULL" ) |
| 233 |
#else // WPP_CHECK_FOR_NULL_STRING |
| 234 |
# define WPP_LOGPCSTR(_x) WPP_LOGCSTR(*(_x)) |
| 235 |
#endif // WPP_CHECK_FOR_NULL_STRING |
| 236 |
#endif // WPP_LOGPCSTR |
| 237 |
|
| 238 |
#ifdef __cplusplus |
| 239 |
|
| 240 |
#ifndef WPP_POINTER_TO_USHORT |
| 241 |
struct WppPointerToUshort |
| 242 |
{ |
| 243 |
USHORT m_val; |
| 244 |
WPP_FORCEINLINE explicit WppPointerToUshort(USHORT val) : m_val(val) {} |
| 245 |
WPP_FORCEINLINE USHORT const* get() const { return &m_val; } |
| 246 |
}; |
| 247 |
#define WPP_POINTER_TO_USHORT(val) (WppPointerToUshort((val)).get()) |
| 248 |
#endif // WPP_POINTER_TO_USHORT |
| 249 |
|
| 250 |
#ifndef WPP_LOGCPPSTR |
| 251 |
#define WPP_LOGCPPSTR(_value) \ |
| 252 |
WPP_LOGPAIR( \ |
| 253 |
sizeof(USHORT), \ |
| 254 |
WPP_POINTER_TO_USHORT((USHORT)((_value).size()*sizeof(*(_value).c_str()))) ) \ |
| 255 |
WPP_LOGPAIR( \ |
| 256 |
(USHORT)((_value).size()*sizeof(*(_value).c_str())), \ |
| 257 |
(_value).c_str() ) |
| 258 |
#endif // WPP_LOGCPPSTR |
| 259 |
|
| 260 |
#ifndef WPP_LOGCPPVEC |
| 261 |
#define WPP_LOGCPPVEC(_value) \ |
| 262 |
WPP_LOGPAIR( \ |
| 263 |
sizeof(USHORT), \ |
| 264 |
WPP_POINTER_TO_USHORT((USHORT)((_value).size()*sizeof(*(_value).data()))) ) \ |
| 265 |
WPP_LOGPAIR( \ |
| 266 |
(USHORT)((_value).size()*sizeof(*(_value).data())), \ |
| 267 |
(_value).data() + ((_value).data() == NULL) ) |
| 268 |
#endif // WPP_LOGCPPVEC |
| 269 |
|
| 270 |
#endif // __cplusplus |
| 271 |
|
| 272 |
#ifndef WPP_BINARY_def |
| 273 |
# define WPP_BINARY_def |
| 274 |
typedef struct tagWPP_BINARY |
| 275 |
{ |
| 276 |
_Field_size_bytes_(Length) void const* Buffer; |
| 277 |
USHORT Length; |
| 278 |
} WPP_BINARY; |
| 279 |
#endif // WPP_BINARY_def |
| 280 |
|
| 281 |
#ifndef WPP_BINARY_func |
| 282 |
# define WPP_BINARY_func |
| 283 |
WPP_FORCEINLINE WPP_BINARY |
| 284 |
WppBinary(_In_reads_bytes_(Length) void const* Buffer, USHORT Length) |
| 285 |
{ |
| 286 |
WPP_BINARY data; |
| 287 |
data.Buffer = Buffer; |
| 288 |
data.Length = Length; |
| 289 |
return data; |
| 290 |
} |
| 291 |
#endif // WPP_BINARY_func |
| 292 |
|
| 293 |
#endif // WPP_ALREADY_INCLUDED |
| 294 |
|
| 295 |
#ifndef WPP_ENABLE_FLAG_BIT |
| 296 |
#define WPP_ENABLE_FLAG_BIT(flag) (WPP_CB[((flag) >> 16)].Control).Flags[( (0xFFFF & ((flag)-1) ) / 32)] & (1 << ( ((flag)-1) & 31 )) |
| 297 |
#endif |
| 298 |
`FORALL i IN TypeSigSet WHERE !UnsafeArgs` |
| 299 |
|
| 300 |
#ifndef WPP_SF_`i.Name`_def |
| 301 |
# define WPP_SF_`i.Name`_def |
| 302 |
WPP_INLINE void WPP_SF_`i.Name`(WPP_LOGGER_ARG unsigned short id, LPCGUID TraceGuid`i.Arguments`) |
| 303 |
{ WPP_TRACE(WPP_GET_LOGGER, WPP_TRACE_OPTIONS, (LPGUID)TraceGuid, id, `i.LogArgs` (void*)0); } |
| 304 |
#endif // WPP_SF_`i.Name`_def |
| 305 |
|
| 306 |
#if ENABLE_WPP_RECORDER |
| 307 |
|
| 308 |
#if ENABLE_WPP_TRACE_FILTERING_WITH_WPP_RECORDER |
| 309 |
|
| 310 |
// |
| 311 |
// Generate the WPP_RECORDER_AND_TRACE_SF_`i.Name` function |
| 312 |
// |
| 313 |
#ifndef WPP_RECORDER_AND_TRACE_SF_`i.Name`_def |
| 314 |
#define WPP_RECORDER_AND_TRACE_SF_`i.Name`_def |
| 315 |
WPP_INLINE |
| 316 |
VOID |
| 317 |
WPP_RECORDER_AND_TRACE_SF_`i.Name`( |
| 318 |
WPP_LOGGER_ARG |
| 319 |
BOOLEAN wppEnabled, |
| 320 |
BOOLEAN recorderEnabled, |
| 321 |
PVOID AutoLogContext, |
| 322 |
UCHAR level, |
| 323 |
ULONG flags, |
| 324 |
USHORT id, |
| 325 |
LPCGUID traceGuid |
| 326 |
`i.Arguments` |
| 327 |
) |
| 328 |
{ |
| 329 |
if (wppEnabled) |
| 330 |
{ |
| 331 |
WPP_TRACE( WPP_GET_LOGGER, |
| 332 |
WPP_TRACE_OPTIONS, |
| 333 |
(LPGUID)traceGuid, |
| 334 |
id, |
| 335 |
`i.LogArgs` (void*)0); |
| 336 |
} |
| 337 |
|
| 338 |
if (recorderEnabled) |
| 339 |
{ |
| 340 |
WPP_RECORDER( AutoLogContext, level, flags, (LPGUID) traceGuid, id, `i.LogArgs` (void*)0 ); |
| 341 |
} |
| 342 |
} |
| 343 |
#endif // WPP_RECORDER_AND_TRACE_SF_`i.Name`_def |
| 344 |
|
| 345 |
#else // ENABLE_WPP_TRACE_FILTERING_WITH_WPP_RECORDER |
| 346 |
|
| 347 |
// |
| 348 |
// Generate the WPP_RECORDER_SP_`i.Name` function |
| 349 |
// |
| 350 |
#ifndef WPP_RECORDER_SF_`i.Name`_def |
| 351 |
#define WPP_RECORDER_SF_`i.Name`_def |
| 352 |
WPP_INLINE |
| 353 |
VOID |
| 354 |
WPP_RECORDER_SF_`i.Name`( |
| 355 |
PVOID AutoLogContext, |
| 356 |
UCHAR level, |
| 357 |
ULONG flags, |
| 358 |
USHORT id, |
| 359 |
LPCGUID traceGuid |
| 360 |
`i.Arguments` |
| 361 |
) |
| 362 |
{ |
| 363 |
if (WPP_ENABLE_FLAG_BIT(flags) && |
| 364 |
(WPP_CONTROL(flags).Level >= level)) |
| 365 |
{ |
| 366 |
WPP_TRACE( |
| 367 |
WPP_CONTROL(flags).Logger, |
| 368 |
WPP_TRACE_OPTIONS, |
| 369 |
(LPGUID)traceGuid, |
| 370 |
id, |
| 371 |
`i.LogArgs` (void*)0); |
| 372 |
} |
| 373 |
|
| 374 |
WPP_RECORDER(AutoLogContext, level, flags, (LPGUID) traceGuid, id, `i.LogArgs` (void*)0); |
| 375 |
} |
| 376 |
#endif // WPP_RECORDER_SF_`i.Name`_def |
| 377 |
|
| 378 |
#endif // ENABLE_WPP_TRACE_FILTERING_WITH_WPP_RECORDER |
| 379 |
|
| 380 |
#endif // ENABLE_WPP_RECORDER |
| 381 |
`ENDFOR` |
| 382 |
`FORALL i IN TypeSigSet WHERE UnsafeArgs` |
| 383 |
|
| 384 |
#ifndef WPP_SF_`i.Name`_def |
| 385 |
#define WPP_SF_`i.Name`_def |
| 386 |
WPP_INLINE void WPP_SF_`i.Name`(WPP_LOGGER_ARG unsigned short id, LPCGUID TraceGuid, ...) |
| 387 |
{ |
| 388 |
va_list ap; |
| 389 |
va_start(ap, TraceGuid); |
| 390 |
UNREFERENCED_PARAMETER(ap); |
| 391 |
{ |
| 392 |
`i.DeclVars` |
| 393 |
WPP_TRACE( |
| 394 |
WPP_GET_LOGGER, |
| 395 |
WPP_TRACE_OPTIONS, |
| 396 |
(LPGUID)TraceGuid, |
| 397 |
id, |
| 398 |
`i.LogArgs` (void*)0); |
| 399 |
} |
| 400 |
} |
| 401 |
#endif // WPP_SF_`i.Name`_def |
| 402 |
`ENDFOR` |
| 403 |
|
| 404 |
// WPP_LOG_ALWAYS: |
| 405 |
// Called for each event: WPP_LOG_ALWAYS(EX, MSG, arg1, arg2, arg3...) Other() |
| 406 |
// If defined, the definition needs to include a trailing comma or semicolon. |
| 407 |
// In addition, you will need to define a WPP_EX_[args](args...) macro to |
| 408 |
// extract any needed information from the other arguments (e.g. LEVEL). |
| 409 |
#ifndef WPP_LOG_ALWAYS |
| 410 |
#define WPP_LOG_ALWAYS(...) |
| 411 |
#endif |
| 412 |
|
| 413 |
// WPP_DEBUG: |
| 414 |
// Called for each enabled event: WPP_DEBUG((MSG, arg1, arg2, arg3...)), Other() |
| 415 |
// Potential definition: printf MsgArgs |
| 416 |
// Definition should not include any trailing comma or semicolon. |
| 417 |
#ifdef WPP_DEBUG |
| 418 |
#define WPP_INVOKE_WPP_DEBUG(MsgArgs) WPP_DEBUG(MsgArgs) |
| 419 |
#else // WPP_DEBUG |
| 420 |
#define WPP_INVOKE_WPP_DEBUG(MsgArgs) (void)0 |
| 421 |
#endif // WPP_DEBUG |
| 422 |
`FORALL i IN Messages WHERE !MsgArgs` |
| 423 |
|
| 424 |
// WPP_CALL_`i.Name` |
| 425 |
#ifndef WPP`i.GooId`_PRE |
| 426 |
# define WPP`i.GooId`_PRE(`i.GooArgs`) |
| 427 |
#endif |
| 428 |
#ifndef WPP`i.GooId`_POST |
| 429 |
# define WPP`i.GooId`_POST(`i.GooArgs`) |
| 430 |
#endif |
| 431 |
#if ENABLE_WPP_RECORDER |
| 432 |
#if ENABLE_WPP_TRACE_FILTERING_WITH_WPP_RECORDER |
| 433 |
#define WPP_CALL_`i.Name`(`i.FixedArgs``i.MacroArgs`) \ |
| 434 |
WPP_LOG_ALWAYS(WPP_EX`i.GooId`(`i.GooVals`), `i.DbgMacroArgs`) \ |
| 435 |
WPP`i.GooId`_PRE(`i.GooVals`) \ |
| 436 |
do {\ |
| 437 |
WPP_ANNOTATE(`i.Name`) 0; \ |
| 438 |
BOOLEAN wppEnabled = WPP_CHECK_INIT `i.MsgVal`WPP`i.GooId`_ENABLED(`i.GooVals`); \ |
| 439 |
BOOLEAN recorderEnabled = WPP_RECORDER_CHECK_INIT `i.MsgVal`WPP_RECORDER`i.GooId`_FILTER(`i.GooVals`); \ |
| 440 |
if (wppEnabled || recorderEnabled) { \ |
| 441 |
WPP_INVOKE_WPP_DEBUG((`i.DbgMacroArgs`)); \ |
| 442 |
WPP_RECORDER_AND_TRACE_SF_`i.TypeSig`( \ |
| 443 |
WPP`i.GooId`_LOGGER(`i.GooVals`) \ |
| 444 |
wppEnabled, recorderEnabled, \ |
| 445 |
WPP_RECORDER`i.GooId`_ARGS(`i.GooVals`), \ |
| 446 |
`i.MsgNo`, \ |
| 447 |
WPP_LOCAL_TraceGuids+0`i.MacroExprs`);\ |
| 448 |
} \ |
| 449 |
} \ |
| 450 |
while(0) \ |
| 451 |
WPP`i.GooId`_POST(`i.GooVals`) |
| 452 |
#else // ENABLE_WPP_TRACE_FILTERING_WITH_WPP_RECORDER |
| 453 |
#define WPP_CALL_`i.Name`(`i.FixedArgs``i.MacroArgs`) \ |
| 454 |
WPP_LOG_ALWAYS(WPP_EX`i.GooId`(`i.GooVals`), `i.DbgMacroArgs`) \ |
| 455 |
WPP`i.GooId`_PRE(`i.GooVals`) \ |
| 456 |
WPP_ANNOTATE(`i.Name`) \ |
| 457 |
(( \ |
| 458 |
WPP_RECORDER_CHECK_INIT `i.MsgVal`WPP_RECORDER`i.GooId`_FILTER(`i.GooVals`) \ |
| 459 |
? WPP_INVOKE_WPP_DEBUG((`i.DbgMacroArgs`)), \ |
| 460 |
WPP_RECORDER_SF_`i.TypeSig`( \ |
| 461 |
WPP_RECORDER`i.GooId`_ARGS(`i.GooVals`), \ |
| 462 |
`i.MsgNo`, \ |
| 463 |
WPP_LOCAL_TraceGuids+0`i.MacroExprs`), \ |
| 464 |
1 \ |
| 465 |
: 0 \ |
| 466 |
)) \ |
| 467 |
WPP`i.GooId`_POST(`i.GooVals`) |
| 468 |
#endif // ENABLE_WPP_TRACE_FILTERING_WITH_WPP_RECORDER |
| 469 |
#else // ENABLE_WPP_RECORDER |
| 470 |
#define WPP_CALL_`i.Name`(`i.FixedArgs``i.MacroArgs`) \ |
| 471 |
WPP_LOG_ALWAYS(WPP_EX`i.GooId`(`i.GooVals`), `i.DbgMacroArgs`) \ |
| 472 |
WPP`i.GooId`_PRE(`i.GooVals`) \ |
| 473 |
WPP_ANNOTATE(`i.Name`) \ |
| 474 |
(( \ |
| 475 |
WPP_CHECK_INIT `i.MsgVal`WPP`i.GooId`_ENABLED(`i.GooVals`) \ |
| 476 |
? WPP_INVOKE_WPP_DEBUG((`i.DbgMacroArgs`)), \ |
| 477 |
WPP_SF_`i.TypeSig`( \ |
| 478 |
WPP`i.GooId`_LOGGER(`i.GooVals`) \ |
| 479 |
`i.MsgNo`, \ |
| 480 |
WPP_LOCAL_TraceGuids+0`i.MacroExprs`), \ |
| 481 |
1 \ |
| 482 |
: 0 \ |
| 483 |
)) \ |
| 484 |
WPP`i.GooId`_POST(`i.GooVals`) |
| 485 |
#endif // ENABLE_WPP_RECORDER |
| 486 |
`ENDFOR` |
| 487 |
`FORALL i IN Messages WHERE MsgArgs` |
| 488 |
|
| 489 |
// WPP_CALL_`i.Name` |
| 490 |
#ifndef WPP`i.GooId`_PRE |
| 491 |
# define WPP`i.GooId`_PRE(`i.GooArgs`) |
| 492 |
#endif |
| 493 |
#ifndef WPP`i.GooId`_POST |
| 494 |
# define WPP`i.GooId`_POST(`i.GooArgs`) |
| 495 |
#endif |
| 496 |
#if ENABLE_WPP_RECORDER |
| 497 |
#define WPP_CALL_`i.Name`(`i.FixedArgs` MSGARGS) \ |
| 498 |
WPP_LOG_ALWAYS(WPP_EX`i.GooId`(`i.GooVals`), WPP_FLATTEN MSGARGS) \ |
| 499 |
WPP`i.GooId`_PRE(`i.GooVals`) \ |
| 500 |
WPP_ANNOTATE(`i.Name`) \ |
| 501 |
(( \ |
| 502 |
WPP_RECORDER_CHECK_INIT `i.MsgVal`WPP_RECORDER`i.GooId`_FILTER(`i.GooVals`) \ |
| 503 |
? WPP_INVOKE_WPP_DEBUG(MSGARGS), \ |
| 504 |
WPP_RECORDER_SF_`i.TypeSig`( \ |
| 505 |
WPP_RECORDER`i.GooId`_ARGS(`i.GooVals`), \ |
| 506 |
`i.MsgNo`, \ |
| 507 |
WPP_LOCAL_TraceGuids+0 `i.SyntheticExprs`WPP_R`i.ReorderSig` MSGARGS), \ |
| 508 |
1 \ |
| 509 |
: 0 \ |
| 510 |
)) \ |
| 511 |
WPP`i.GooId`_POST(`i.GooVals`) |
| 512 |
#else // ENABLE_WPP_RECORDER |
| 513 |
#define WPP_CALL_`i.Name`(`i.FixedArgs` MSGARGS) \ |
| 514 |
WPP_LOG_ALWAYS(WPP_EX`i.GooId`(`i.GooVals`), WPP_FLATTEN MSGARGS) \ |
| 515 |
WPP`i.GooId`_PRE(`i.GooVals`) \ |
| 516 |
WPP_ANNOTATE(`i.Name`) \ |
| 517 |
(( \ |
| 518 |
WPP_CHECK_INIT WPP`i.GooId`_ENABLED(`i.GooVals`) \ |
| 519 |
? WPP_INVOKE_WPP_DEBUG(MSGARGS), \ |
| 520 |
WPP_SF_`i.TypeSig`( \ |
| 521 |
WPP`i.GooId`_LOGGER(`i.GooVals`) \ |
| 522 |
`i.MsgNo`, \ |
| 523 |
WPP_LOCAL_TraceGuids+0 `i.SyntheticExprs`WPP_R`i.ReorderSig` MSGARGS),\ |
| 524 |
1 \ |
| 525 |
: 0 \ |
| 526 |
)) \ |
| 527 |
WPP`i.GooId`_POST(`i.GooVals`) |
| 528 |
#endif // ENABLE_WPP_RECORDER |
| 529 |
`ENDFOR` |
| 530 |
|
| 531 |
// Functions |
| 532 |
`FORALL f IN Funcs WHERE !DoubleP && !MsgArgs && !NoMsg` |
| 533 |
#undef `f.Name` |
| 534 |
#ifdef __INTELLISENSE__ |
| 535 |
#define `f.Name`(`f.FixedArgs`MSG, ...) ((void)(MSG, ## __VA_ARGS__)) |
| 536 |
#else |
| 537 |
#define `f.Name` WPP_(CALL) |
| 538 |
#endif |
| 539 |
`ENDFOR` |
| 540 |
`FORALL f IN Funcs WHERE !DoubleP && !MsgArgs && NoMsg` |
| 541 |
#undef `f.Name` |
| 542 |
#ifdef __INTELLISENSE__ |
| 543 |
#define `f.Name`(`f.FixedArgs`) ((void)0) |
| 544 |
#else |
| 545 |
#define `f.Name` WPP_(CALL) |
| 546 |
#endif |
| 547 |
`ENDFOR` |
| 548 |
`FORALL f IN Funcs WHERE DoubleP && !MsgArgs` |
| 549 |
#undef `f.Name` |
| 550 |
#ifdef __INTELLISENSE__ |
| 551 |
#define `f.Name`(ARGS) ((void)ARGS) |
| 552 |
#else |
| 553 |
#define `f.Name`(ARGS) WPP_(CALL) ARGS |
| 554 |
#endif |
| 555 |
`ENDFOR` |
| 556 |
`FORALL f IN Funcs WHERE MsgArgs` |
| 557 |
#undef `f.Name` |
| 558 |
#ifdef __INTELLISENSE__ |
| 559 |
#define `f.Name`(`f.FixedArgs`MSGARGS) ((void)(MSGARGS)) |
| 560 |
#else |
| 561 |
#define `f.Name`(`f.FixedArgs`MSGARGS) WPP_(CALL)(`f.FixedArgs`MSGARGS) |
| 562 |
#endif |
| 563 |
`ENDFOR` |
| 564 |
`FORALL r IN Reorder` |
| 565 |
#undef WPP_R`r.Name` |
| 566 |
#define WPP_R`r.Name`(`r.Arguments`) `r.Permutation` |
| 567 |
`ENDFOR` |
| 568 |
|
| 569 |
#ifdef __cplusplus |
| 570 |
} // extern "C" |
| 571 |
#endif |