| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 */ | 41 */ |
| 42 | 42 |
| 43 #include <wtf/Platform.h> | 43 #include <wtf/Platform.h> |
| 44 | 44 |
| 45 #include <stddef.h> | 45 #include <stddef.h> |
| 46 | 46 |
| 47 #if !COMPILER(MSVC) | 47 #if !COMPILER(MSVC) |
| 48 #include <inttypes.h> | 48 #include <inttypes.h> |
| 49 #endif | 49 #endif |
| 50 | 50 |
| 51 #include "wtf/WTFExport.h" |
| 52 |
| 51 #ifdef NDEBUG | 53 #ifdef NDEBUG |
| 52 /* Disable ASSERT* macros in release mode. */ | 54 /* Disable ASSERT* macros in release mode. */ |
| 53 #define ASSERTIONS_DISABLED_DEFAULT 1 | 55 #define ASSERTIONS_DISABLED_DEFAULT 1 |
| 54 #else | 56 #else |
| 55 #define ASSERTIONS_DISABLED_DEFAULT 0 | 57 #define ASSERTIONS_DISABLED_DEFAULT 0 |
| 56 #endif | 58 #endif |
| 57 | 59 |
| 58 #ifndef BACKTRACE_DISABLED | 60 #ifndef BACKTRACE_DISABLED |
| 59 #define BACKTRACE_DISABLED ASSERTIONS_DISABLED_DEFAULT | 61 #define BACKTRACE_DISABLED ASSERTIONS_DISABLED_DEFAULT |
| 60 #endif | 62 #endif |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 #endif | 107 #endif |
| 106 | 108 |
| 107 typedef enum { WTFLogChannelOff, WTFLogChannelOn } WTFLogChannelState; | 109 typedef enum { WTFLogChannelOff, WTFLogChannelOn } WTFLogChannelState; |
| 108 | 110 |
| 109 typedef struct { | 111 typedef struct { |
| 110 unsigned mask; | 112 unsigned mask; |
| 111 const char *defaultName; | 113 const char *defaultName; |
| 112 WTFLogChannelState state; | 114 WTFLogChannelState state; |
| 113 } WTFLogChannel; | 115 } WTFLogChannel; |
| 114 | 116 |
| 115 void WTFReportAssertionFailure(const char* file, int line, const char* function,
const char* assertion); | 117 WTF_EXPORT void WTFReportAssertionFailure(const char* file, int line, const char
* function, const char* assertion); |
| 116 void WTFReportAssertionFailureWithMessage(const char* file, int line, const char
* function, const char* assertion, const char* format, ...) WTF_ATTRIBUTE_PRINTF
(5, 6); | 118 WTF_EXPORT void WTFReportAssertionFailureWithMessage(const char* file, int line,
const char* function, const char* assertion, const char* format, ...) WTF_ATTRI
BUTE_PRINTF(5, 6); |
| 117 void WTFReportArgumentAssertionFailure(const char* file, int line, const char* f
unction, const char* argName, const char* assertion); | 119 WTF_EXPORT void WTFReportArgumentAssertionFailure(const char* file, int line, co
nst char* function, const char* argName, const char* assertion); |
| 118 void WTFReportFatalError(const char* file, int line, const char* function, const
char* format, ...) WTF_ATTRIBUTE_PRINTF(4, 5); | 120 WTF_EXPORT void WTFReportFatalError(const char* file, int line, const char* func
tion, const char* format, ...) WTF_ATTRIBUTE_PRINTF(4, 5); |
| 119 void WTFReportError(const char* file, int line, const char* function, const char
* format, ...) WTF_ATTRIBUTE_PRINTF(4, 5); | 121 WTF_EXPORT void WTFReportError(const char* file, int line, const char* function,
const char* format, ...) WTF_ATTRIBUTE_PRINTF(4, 5); |
| 120 void WTFLog(WTFLogChannel*, const char* format, ...) WTF_ATTRIBUTE_PRINTF(2, 3); | 122 WTF_EXPORT void WTFLog(WTFLogChannel*, const char* format, ...) WTF_ATTRIBUTE_PR
INTF(2, 3); |
| 121 void WTFLogVerbose(const char* file, int line, const char* function, WTFLogChann
el*, const char* format, ...) WTF_ATTRIBUTE_PRINTF(5, 6); | 123 WTF_EXPORT void WTFLogVerbose(const char* file, int line, const char* function,
WTFLogChannel*, const char* format, ...) WTF_ATTRIBUTE_PRINTF(5, 6); |
| 122 void WTFLogAlways(const char* format, ...) WTF_ATTRIBUTE_PRINTF(1, 2); | 124 WTF_EXPORT void WTFLogAlways(const char* format, ...) WTF_ATTRIBUTE_PRINTF(1, 2)
; |
| 123 | 125 |
| 124 void WTFGetBacktrace(void** stack, int* size); | 126 WTF_EXPORT void WTFGetBacktrace(void** stack, int* size); |
| 125 void WTFReportBacktrace(); | 127 WTF_EXPORT void WTFReportBacktrace(); |
| 126 void WTFPrintBacktrace(void** stack, int size); | 128 WTF_EXPORT void WTFPrintBacktrace(void** stack, int size); |
| 127 | 129 |
| 128 typedef void (*WTFCrashHookFunction)(); | 130 typedef void (*WTFCrashHookFunction)(); |
| 129 void WTFSetCrashHook(WTFCrashHookFunction); | 131 WTF_EXPORT void WTFSetCrashHook(WTFCrashHookFunction); |
| 130 void WTFInvokeCrashHook(); | 132 WTF_EXPORT void WTFInvokeCrashHook(); |
| 131 void WTFInstallReportBacktraceOnCrashHook(); | 133 WTF_EXPORT void WTFInstallReportBacktraceOnCrashHook(); |
| 132 | 134 |
| 133 #ifdef __cplusplus | 135 #ifdef __cplusplus |
| 134 } | 136 } |
| 135 #endif | 137 #endif |
| 136 | 138 |
| 137 /* IMMEDIATE_CRASH() - Like CRASH() below but crashes in the fastest, simplest p
ossible way with no attempt at logging. */ | 139 /* IMMEDIATE_CRASH() - Like CRASH() below but crashes in the fastest, simplest p
ossible way with no attempt at logging. */ |
| 138 #ifndef IMMEDIATE_CRASH | 140 #ifndef IMMEDIATE_CRASH |
| 139 #if COMPILER(GCC) | 141 #if COMPILER(GCC) |
| 140 #define IMMEDIATE_CRASH() __builtin_trap() | 142 #define IMMEDIATE_CRASH() __builtin_trap() |
| 141 #else | 143 #else |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 #define RELEASE_ASSERT(assertion) (UNLIKELY(!(assertion)) ? (IMMEDIATE_CRASH())
: (void)0) | 372 #define RELEASE_ASSERT(assertion) (UNLIKELY(!(assertion)) ? (IMMEDIATE_CRASH())
: (void)0) |
| 371 #define RELEASE_ASSERT_WITH_MESSAGE(assertion, ...) RELEASE_ASSERT(assertion) | 373 #define RELEASE_ASSERT_WITH_MESSAGE(assertion, ...) RELEASE_ASSERT(assertion) |
| 372 #define RELEASE_ASSERT_NOT_REACHED() IMMEDIATE_CRASH() | 374 #define RELEASE_ASSERT_NOT_REACHED() IMMEDIATE_CRASH() |
| 373 #else | 375 #else |
| 374 #define RELEASE_ASSERT(assertion) ASSERT(assertion) | 376 #define RELEASE_ASSERT(assertion) ASSERT(assertion) |
| 375 #define RELEASE_ASSERT_WITH_MESSAGE(assertion, ...) ASSERT_WITH_MESSAGE(assertio
n, __VA_ARGS__) | 377 #define RELEASE_ASSERT_WITH_MESSAGE(assertion, ...) ASSERT_WITH_MESSAGE(assertio
n, __VA_ARGS__) |
| 376 #define RELEASE_ASSERT_NOT_REACHED() ASSERT_NOT_REACHED() | 378 #define RELEASE_ASSERT_NOT_REACHED() ASSERT_NOT_REACHED() |
| 377 #endif | 379 #endif |
| 378 | 380 |
| 379 #endif /* WTF_Assertions_h */ | 381 #endif /* WTF_Assertions_h */ |
| OLD | NEW |