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 25 matching lines...) Expand all Loading... |
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 Loading... |
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 */ |
OLD | NEW |