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

Side by Side Diff: base/logging.h

Issue 2676483002: Make CHECK int 3 on Windows, rather than crash (Closed)
Patch Set: no need to special case #if for clang Created 3 years, 10 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
« no previous file with comments | « no previous file | base/logging_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 // Returns true if the check succeeded. 490 // Returns true if the check succeeded.
491 operator bool() const { return !message_; } 491 operator bool() const { return !message_; }
492 // Returns the message. 492 // Returns the message.
493 std::string* message() { return message_; } 493 std::string* message() { return message_; }
494 494
495 private: 495 private:
496 std::string* message_; 496 std::string* message_;
497 }; 497 };
498 498
499 // Crashes in the fastest, simplest possible way with no attempt at logging. 499 // Crashes in the fastest, simplest possible way with no attempt at logging.
500 #if defined(COMPILER_GCC) || defined(__clang__) 500 #if defined(COMPILER_GCC)
501 #define IMMEDIATE_CRASH() __builtin_trap() 501 #define IMMEDIATE_CRASH() __builtin_trap()
502 #elif defined(COMPILER_MSVC)
503 #define IMMEDIATE_CRASH() __debugbreak()
502 #else 504 #else
503 #define IMMEDIATE_CRASH() ((void)(*(volatile char*)0 = 0)) 505 #error Port
504 #endif 506 #endif
505 507
506 // CHECK dies with a fatal error if condition is not true. It is *not* 508 // CHECK dies with a fatal error if condition is not true. It is *not*
507 // controlled by NDEBUG, so the check will be executed regardless of 509 // controlled by NDEBUG, so the check will be executed regardless of
508 // compilation mode. 510 // compilation mode.
509 // 511 //
510 // We make sure CHECK et al. always evaluates their arguments, as 512 // We make sure CHECK et al. always evaluates their arguments, as
511 // doing CHECK(FunctionWithSideEffect()) is a common idiom. 513 // doing CHECK(FunctionWithSideEffect()) is a common idiom.
512 514
513 #if defined(OFFICIAL_BUILD) && defined(NDEBUG) 515 #if defined(OFFICIAL_BUILD) && defined(NDEBUG)
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 #elif NOTIMPLEMENTED_POLICY == 5 1053 #elif NOTIMPLEMENTED_POLICY == 5
1052 #define NOTIMPLEMENTED() do {\ 1054 #define NOTIMPLEMENTED() do {\
1053 static bool logged_once = false;\ 1055 static bool logged_once = false;\
1054 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\ 1056 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\
1055 logged_once = true;\ 1057 logged_once = true;\
1056 } while(0);\ 1058 } while(0);\
1057 EAT_STREAM_PARAMETERS 1059 EAT_STREAM_PARAMETERS
1058 #endif 1060 #endif
1059 1061
1060 #endif // BASE_LOGGING_H_ 1062 #endif // BASE_LOGGING_H_
OLDNEW
« no previous file with comments | « no previous file | base/logging_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698