OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef BASE_LOGGING_H_ | 5 #ifndef BASE_LOGGING_H_ |
6 #define BASE_LOGGING_H_ | 6 #define BASE_LOGGING_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <cassert> | 10 #include <cassert> |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 | 503 |
504 // Clang is cleverer about coalescing int3s, so we need to add a unique-ish | 504 // Clang is cleverer about coalescing int3s, so we need to add a unique-ish |
505 // instruction following the __debugbreak() to have it emit distinct locations | 505 // instruction following the __debugbreak() to have it emit distinct locations |
506 // for CHECKs rather than collapsing them all together. It would be nice to use | 506 // for CHECKs rather than collapsing them all together. It would be nice to use |
507 // a short intrinsic to do this (and perhaps have only one implementation for | 507 // a short intrinsic to do this (and perhaps have only one implementation for |
508 // both clang and MSVC), however clang-cl currently does not support intrinsics | 508 // both clang and MSVC), however clang-cl currently does not support intrinsics |
509 // here. Adding the nullptr store to the MSVC path adds unnecessary bloat. | 509 // here. Adding the nullptr store to the MSVC path adds unnecessary bloat. |
510 // TODO(scottmg): Reinvestigate a short sequence that will work on both | 510 // TODO(scottmg): Reinvestigate a short sequence that will work on both |
511 // compilers once clang supports more intrinsics. See https://crbug.com/693713. | 511 // compilers once clang supports more intrinsics. See https://crbug.com/693713. |
512 #if defined(__clang__) | 512 #if defined(__clang__) |
513 #define IMMEDIATE_CRASH() \ | 513 #define IMMEDIATE_CRASH() \ |
514 (__debugbreak(), \ | 514 (__debugbreak(), (void)(*reinterpret_cast<volatile unsigned char*>(0) = \ |
515 (void)(*reinterpret_cast<volatile unsigned char*>(0) = __COUNTER__)) | 515 static_cast<unsigned char>(__COUNTER__))) |
516 #else | 516 #else |
517 #define IMMEDIATE_CRASH() __debugbreak() | 517 #define IMMEDIATE_CRASH() __debugbreak() |
518 #endif // __clang__ | 518 #endif // __clang__ |
519 | 519 |
520 #else | 520 #else |
521 #error Port | 521 #error Port |
522 #endif | 522 #endif |
523 | 523 |
524 // CHECK dies with a fatal error if condition is not true. It is *not* | 524 // CHECK dies with a fatal error if condition is not true. It is *not* |
525 // controlled by NDEBUG, so the check will be executed regardless of | 525 // controlled by NDEBUG, so the check will be executed regardless of |
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1073 #elif NOTIMPLEMENTED_POLICY == 5 | 1073 #elif NOTIMPLEMENTED_POLICY == 5 |
1074 #define NOTIMPLEMENTED() do {\ | 1074 #define NOTIMPLEMENTED() do {\ |
1075 static bool logged_once = false;\ | 1075 static bool logged_once = false;\ |
1076 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\ | 1076 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\ |
1077 logged_once = true;\ | 1077 logged_once = true;\ |
1078 } while(0);\ | 1078 } while(0);\ |
1079 EAT_STREAM_PARAMETERS | 1079 EAT_STREAM_PARAMETERS |
1080 #endif | 1080 #endif |
1081 | 1081 |
1082 #endif // BASE_LOGGING_H_ | 1082 #endif // BASE_LOGGING_H_ |
OLD | NEW |