Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(303)

Side by Side Diff: third_party/WebKit/Source/wtf/Assertions.h

Issue 1826283004: Revert NotImplemented() changes in r383029 and r383047. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 #define ENABLE_ASSERT 0 55 #define ENABLE_ASSERT 0
56 #else 56 #else
57 #define ENABLE_ASSERT 1 57 #define ENABLE_ASSERT 1
58 #endif /* defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON) */ 58 #endif /* defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON) */
59 #endif 59 #endif
60 60
61 #ifndef ASSERT_MSG_DISABLED 61 #ifndef ASSERT_MSG_DISABLED
62 #define ASSERT_MSG_DISABLED !ENABLE(ASSERT) 62 #define ASSERT_MSG_DISABLED !ENABLE(ASSERT)
63 #endif 63 #endif
64 64
65 #ifndef ASSERT_ARG_DISABLED
66 #define ASSERT_ARG_DISABLED !ENABLE(ASSERT)
67 #endif
68
65 #ifndef LOG_DISABLED 69 #ifndef LOG_DISABLED
66 #define LOG_DISABLED !ENABLE(ASSERT) 70 #define LOG_DISABLED !ENABLE(ASSERT)
67 #endif 71 #endif
68 72
69 #if COMPILER(GCC) 73 #if COMPILER(GCC)
70 #define WTF_ATTRIBUTE_PRINTF(formatStringArgument, extraArguments) __attribute__ ((__format__(printf, formatStringArgument, extraArguments))) 74 #define WTF_ATTRIBUTE_PRINTF(formatStringArgument, extraArguments) __attribute__ ((__format__(printf, formatStringArgument, extraArguments)))
71 #else 75 #else
72 #define WTF_ATTRIBUTE_PRINTF(formatStringArgument, extraArguments) 76 #define WTF_ATTRIBUTE_PRINTF(formatStringArgument, extraArguments)
73 #endif 77 #endif
74 78
75 /* These helper functions are always declared, but not necessarily always define d if the corresponding function is disabled. */ 79 /* These helper functions are always declared, but not necessarily always define d if the corresponding function is disabled. */
76 80
77 typedef enum { WTFLogChannelOff, WTFLogChannelOn } WTFLogChannelState; 81 typedef enum { WTFLogChannelOff, WTFLogChannelOn } WTFLogChannelState;
78 82
79 typedef struct { 83 typedef struct {
80 WTFLogChannelState state; 84 WTFLogChannelState state;
81 } WTFLogChannel; 85 } WTFLogChannel;
82 86
83 WTF_EXPORT void WTFReportAssertionFailure(const char* file, int line, const char * function, const char* assertion); 87 WTF_EXPORT void WTFReportAssertionFailure(const char* file, int line, const char * function, const char* assertion);
88 WTF_EXPORT void WTFReportArgumentAssertionFailure(const char* file, int line, co nst char* function, const char* argName, const char* assertion);
84 WTF_EXPORT void WTFLog(WTFLogChannel*, const char* format, ...) WTF_ATTRIBUTE_PR INTF(2, 3); 89 WTF_EXPORT void WTFLog(WTFLogChannel*, const char* format, ...) WTF_ATTRIBUTE_PR INTF(2, 3);
90 WTF_EXPORT void WTFLogVerbose(const char* file, int line, const char* function, WTFLogChannel*, const char* format, ...) WTF_ATTRIBUTE_PRINTF(5, 6);
85 WTF_EXPORT void WTFLogAlways(const char* format, ...) WTF_ATTRIBUTE_PRINTF(1, 2) ; 91 WTF_EXPORT void WTFLogAlways(const char* format, ...) WTF_ATTRIBUTE_PRINTF(1, 2) ;
86 92
87 WTF_EXPORT void WTFGetBacktrace(void** stack, int* size); 93 WTF_EXPORT void WTFGetBacktrace(void** stack, int* size);
88 WTF_EXPORT void WTFReportBacktrace(int framesToShow = 31); 94 WTF_EXPORT void WTFReportBacktrace(int framesToShow = 31);
89 WTF_EXPORT void WTFPrintBacktrace(void** stack, int size); 95 WTF_EXPORT void WTFPrintBacktrace(void** stack, int size);
90 96
91 /* IMMEDIATE_CRASH() - Like CRASH() below but crashes in the fastest, simplest p ossible way with no attempt at logging. */ 97 /* IMMEDIATE_CRASH() - Like CRASH() below but crashes in the fastest, simplest p ossible way with no attempt at logging. */
92 #ifndef IMMEDIATE_CRASH 98 #ifndef IMMEDIATE_CRASH
93 #if COMPILER(GCC) || COMPILER(CLANG) 99 #if COMPILER(GCC) || COMPILER(CLANG)
94 #define IMMEDIATE_CRASH() __builtin_trap() 100 #define IMMEDIATE_CRASH() __builtin_trap()
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 #endif 194 #endif
189 195
190 // Users must test "#if ENABLE(SECURITY_ASSERT)", which helps ensure 196 // Users must test "#if ENABLE(SECURITY_ASSERT)", which helps ensure
191 // that code testing this macro has included this header. 197 // that code testing this macro has included this header.
192 #if defined(ADDRESS_SANITIZER) || ENABLE(ASSERT) 198 #if defined(ADDRESS_SANITIZER) || ENABLE(ASSERT)
193 #define ENABLE_SECURITY_ASSERT 1 199 #define ENABLE_SECURITY_ASSERT 1
194 #else 200 #else
195 #define ENABLE_SECURITY_ASSERT 0 201 #define ENABLE_SECURITY_ASSERT 0
196 #endif 202 #endif
197 203
204 /* ASSERT_ARG */
205
206 #if ASSERT_ARG_DISABLED
207
208 #define ASSERT_ARG(argName, assertion) ((void)0)
209
210 #else
211
212 #define ASSERT_ARG(argName, assertion) do \
213 if (!(assertion)) { \
214 WTFReportArgumentAssertionFailure(__FILE__, __LINE__, WTF_PRETTY_FUNCTIO N, #argName, #assertion); \
215 CRASH(); \
216 } \
217 while (0)
218
219 #endif
220
198 // WTF_LOG 221 // WTF_LOG
199 // This is deprecated. Should be replaced with DVLOG(verboselevel), which works 222 // This is deprecated. Should be replaced with DVLOG(verboselevel), which works
200 // only in debug build, or VLOG(verboselevel), which works in release build too. 223 // only in debug build, or VLOG(verboselevel), which works in release build too.
201 #if LOG_DISABLED 224 #if LOG_DISABLED
202 #define WTF_LOG(channel, ...) ((void)0) 225 #define WTF_LOG(channel, ...) ((void)0)
203 #else 226 #else
204 #define WTF_LOG(channel, ...) WTFLog(&JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_P REFIX, channel), __VA_ARGS__) 227 #define WTF_LOG(channel, ...) WTFLog(&JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_P REFIX, channel), __VA_ARGS__)
205 #define JOIN_LOG_CHANNEL_WITH_PREFIX(prefix, channel) JOIN_LOG_CHANNEL_WITH_PREF IX_LEVEL_2(prefix, channel) 228 #define JOIN_LOG_CHANNEL_WITH_PREFIX(prefix, channel) JOIN_LOG_CHANNEL_WITH_PREF IX_LEVEL_2(prefix, channel)
206 #define JOIN_LOG_CHANNEL_WITH_PREFIX_LEVEL_2(prefix, channel) prefix ## channel 229 #define JOIN_LOG_CHANNEL_WITH_PREFIX_LEVEL_2(prefix, channel) prefix ## channel
207 #endif 230 #endif
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 } \ 284 } \
262 inline const thisType& to##thisType(const argumentType& argumentName) \ 285 inline const thisType& to##thisType(const argumentType& argumentName) \
263 { \ 286 { \
264 ASSERT_WITH_SECURITY_IMPLICATION(referencePredicate); \ 287 ASSERT_WITH_SECURITY_IMPLICATION(referencePredicate); \
265 return static_cast<const thisType&>(argumentName); \ 288 return static_cast<const thisType&>(argumentName); \
266 } \ 289 } \
267 void to##thisType(const thisType*); \ 290 void to##thisType(const thisType*); \
268 void to##thisType(const thisType&) 291 void to##thisType(const thisType&)
269 292
270 #endif /* WTF_Assertions_h */ 293 #endif /* WTF_Assertions_h */
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.cpp ('k') | third_party/WebKit/Source/wtf/Assertions.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698