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

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

Issue 397733004: Allow assertions to be enabled in Blink Release builds. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased. Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/web/WebScopedMicrotaskSuppression.cpp ('k') | Source/wtf/DefaultAllocator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 25 matching lines...) Expand all
36 For non-debug builds, everything is disabled by default, except for the 36 For non-debug builds, everything is disabled by default, except for the
37 RELEASE_ASSERT family of macros. 37 RELEASE_ASSERT family of macros.
38 38
39 Defining any of the symbols explicitly prevents this from having any effect. 39 Defining any of the symbols explicitly prevents this from having any effect.
40 40
41 */ 41 */
42 42
43 #include "wtf/Compiler.h" 43 #include "wtf/Compiler.h"
44 #include "wtf/WTFExport.h" 44 #include "wtf/WTFExport.h"
45 45
46 #ifdef NDEBUG
47 /* Disable ASSERT* macros in release mode. */
48 #define ASSERTIONS_DISABLED_DEFAULT 1
49 #else
50 #define ASSERTIONS_DISABLED_DEFAULT 0
51 #endif
52
53 #ifndef BACKTRACE_DISABLED
54 #define BACKTRACE_DISABLED ASSERTIONS_DISABLED_DEFAULT
55 #endif
56
57 // Users must test "#if ENABLE(ASSERT)", which helps ensure that code 46 // Users must test "#if ENABLE(ASSERT)", which helps ensure that code
58 // testing this macro has included this header. 47 // testing this macro has included this header.
59 #ifndef ENABLE_ASSERT 48 #ifndef ENABLE_ASSERT
60 // Notice the not below: 49 #ifdef NDEBUG
61 #define ENABLE_ASSERT !ASSERTIONS_DISABLED_DEFAULT 50 /* Disable ASSERT* macros in release mode by default. */
51 #define ENABLE_ASSERT 0
52 #else
53 #define ENABLE_ASSERT 1
54 #endif /* NDEBUG */
55 #endif
56
57 #ifndef BACKTRACE_DISABLED
58 #define BACKTRACE_DISABLED !ENABLE(ASSERT)
62 #endif 59 #endif
63 60
64 #ifndef ASSERT_MSG_DISABLED 61 #ifndef ASSERT_MSG_DISABLED
65 #define ASSERT_MSG_DISABLED !ENABLE(ASSERT) 62 #define ASSERT_MSG_DISABLED !ENABLE(ASSERT)
66 #endif 63 #endif
67 64
68 #ifndef ASSERT_ARG_DISABLED 65 #ifndef ASSERT_ARG_DISABLED
69 #define ASSERT_ARG_DISABLED !ENABLE(ASSERT) 66 #define ASSERT_ARG_DISABLED !ENABLE(ASSERT)
70 #endif 67 #endif
71 68
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 } \ 419 } \
423 inline const thisType& to##thisType(const argumentType& argumentName) \ 420 inline const thisType& to##thisType(const argumentType& argumentName) \
424 { \ 421 { \
425 ASSERT_WITH_SECURITY_IMPLICATION(referencePredicate); \ 422 ASSERT_WITH_SECURITY_IMPLICATION(referencePredicate); \
426 return static_cast<const thisType&>(argumentName); \ 423 return static_cast<const thisType&>(argumentName); \
427 } \ 424 } \
428 void to##thisType(const thisType*); \ 425 void to##thisType(const thisType*); \
429 void to##thisType(const thisType&) 426 void to##thisType(const thisType&)
430 427
431 #endif /* WTF_Assertions_h */ 428 #endif /* WTF_Assertions_h */
OLDNEW
« no previous file with comments | « Source/web/WebScopedMicrotaskSuppression.cpp ('k') | Source/wtf/DefaultAllocator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698