Chromium Code Reviews| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 44 #include "base/logging.h" | 44 #include "base/logging.h" |
| 45 #include "wtf/Compiler.h" | 45 #include "wtf/Compiler.h" |
| 46 #include "wtf/Noncopyable.h" | 46 #include "wtf/Noncopyable.h" |
| 47 #include "wtf/WTFExport.h" | 47 #include "wtf/WTFExport.h" |
| 48 #include "wtf/build_config.h" | 48 #include "wtf/build_config.h" |
| 49 #include <stdarg.h> | 49 #include <stdarg.h> |
| 50 | 50 |
| 51 // Users must test "#if ENABLE(ASSERT)", which helps ensure that code | 51 // Users must test "#if ENABLE(ASSERT)", which helps ensure that code |
| 52 // testing this macro has included this header. | 52 // testing this macro has included this header. |
| 53 #ifndef ENABLE_ASSERT | 53 #ifndef ENABLE_ASSERT |
| 54 #if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON) | 54 #if DCHECK_IS_ON() && !defined(DCHECK_IS_DUMP_WITHOUT_CRASH) |
| 55 /* Enable ASSERT* macros if DCHECK is on, unless it dumps-without-crashing. */ | |
|
Nico
2016/03/31 22:11:17
nit: use // comments
also, don't repeat the line a
| |
| 56 #define ENABLE_ASSERT 1 | |
| 57 #else | |
| 55 /* Disable ASSERT* macros in release mode by default. */ | 58 /* Disable ASSERT* macros in release mode by default. */ |
| 56 #define ENABLE_ASSERT 0 | 59 #define ENABLE_ASSERT 0 |
| 57 #else | 60 #endif /* DCHECK_IS_ON() */ |
| 58 #define ENABLE_ASSERT 1 | |
| 59 #endif /* defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON) */ | |
| 60 #endif | 61 #endif |
| 61 | 62 |
| 62 #ifndef ASSERT_MSG_DISABLED | 63 #ifndef ASSERT_MSG_DISABLED |
| 63 #define ASSERT_MSG_DISABLED !ENABLE(ASSERT) | 64 #define ASSERT_MSG_DISABLED !ENABLE(ASSERT) |
| 64 #endif | 65 #endif |
| 65 | 66 |
| 66 #ifndef LOG_DISABLED | 67 #ifndef LOG_DISABLED |
| 67 #define LOG_DISABLED !ENABLE(ASSERT) | 68 #define LOG_DISABLED !ENABLE(ASSERT) |
| 68 #endif | 69 #endif |
| 69 | 70 |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 322 } \ | 323 } \ |
| 323 inline const thisType& to##thisType(const argumentType& argumentName) \ | 324 inline const thisType& to##thisType(const argumentType& argumentName) \ |
| 324 { \ | 325 { \ |
| 325 ASSERT_WITH_SECURITY_IMPLICATION(referencePredicate); \ | 326 ASSERT_WITH_SECURITY_IMPLICATION(referencePredicate); \ |
| 326 return static_cast<const thisType&>(argumentName); \ | 327 return static_cast<const thisType&>(argumentName); \ |
| 327 } \ | 328 } \ |
| 328 void to##thisType(const thisType*); \ | 329 void to##thisType(const thisType*); \ |
| 329 void to##thisType(const thisType&) | 330 void to##thisType(const thisType&) |
| 330 | 331 |
| 331 #endif /* WTF_Assertions_h */ | 332 #endif /* WTF_Assertions_h */ |
| OLD | NEW |