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

Side by Side Diff: base/logging.h

Issue 24313004: Log an error in release builds when NOTREACHED is hit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Code review fix Created 7 years, 3 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 | « no previous file | no next file » | 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 <cassert> 8 #include <cassert>
9 #include <string> 9 #include <string>
10 #include <cstring> 10 #include <cstring>
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 // and the other is NULL. To work around this, simply static_cast NULL to the 769 // and the other is NULL. To work around this, simply static_cast NULL to the
770 // type of the desired pointer. 770 // type of the desired pointer.
771 771
772 #define DCHECK_EQ(val1, val2) DCHECK_OP(EQ, ==, val1, val2) 772 #define DCHECK_EQ(val1, val2) DCHECK_OP(EQ, ==, val1, val2)
773 #define DCHECK_NE(val1, val2) DCHECK_OP(NE, !=, val1, val2) 773 #define DCHECK_NE(val1, val2) DCHECK_OP(NE, !=, val1, val2)
774 #define DCHECK_LE(val1, val2) DCHECK_OP(LE, <=, val1, val2) 774 #define DCHECK_LE(val1, val2) DCHECK_OP(LE, <=, val1, val2)
775 #define DCHECK_LT(val1, val2) DCHECK_OP(LT, < , val1, val2) 775 #define DCHECK_LT(val1, val2) DCHECK_OP(LT, < , val1, val2)
776 #define DCHECK_GE(val1, val2) DCHECK_OP(GE, >=, val1, val2) 776 #define DCHECK_GE(val1, val2) DCHECK_OP(GE, >=, val1, val2)
777 #define DCHECK_GT(val1, val2) DCHECK_OP(GT, > , val1, val2) 777 #define DCHECK_GT(val1, val2) DCHECK_OP(GT, > , val1, val2)
778 778
779 #if defined(NDEBUG) && defined(OS_CHROMEOS)
780 #define NOTREACHED() LOG(ERROR) << "NOTREACHED() hit in " << \
781 __FUNCTION__ << ". "
782 #else
779 #define NOTREACHED() DCHECK(false) 783 #define NOTREACHED() DCHECK(false)
784 #endif
780 785
781 // Redefine the standard assert to use our nice log files 786 // Redefine the standard assert to use our nice log files
782 #undef assert 787 #undef assert
783 #define assert(x) DLOG_ASSERT(x) 788 #define assert(x) DLOG_ASSERT(x)
784 789
785 // This class more or less represents a particular log message. You 790 // This class more or less represents a particular log message. You
786 // create an instance of LogMessage and then stream stuff to it. 791 // create an instance of LogMessage and then stream stuff to it.
787 // When you finish streaming to it, ~LogMessage is called and the 792 // When you finish streaming to it, ~LogMessage is called and the
788 // full message gets streamed to the appropriate destination. 793 // full message gets streamed to the appropriate destination.
789 // 794 //
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 #elif NOTIMPLEMENTED_POLICY == 5 1018 #elif NOTIMPLEMENTED_POLICY == 5
1014 #define NOTIMPLEMENTED() do {\ 1019 #define NOTIMPLEMENTED() do {\
1015 static bool logged_once = false;\ 1020 static bool logged_once = false;\
1016 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\ 1021 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\
1017 logged_once = true;\ 1022 logged_once = true;\
1018 } while(0);\ 1023 } while(0);\
1019 EAT_STREAM_PARAMETERS 1024 EAT_STREAM_PARAMETERS
1020 #endif 1025 #endif
1021 1026
1022 #endif // BASE_LOGGING_H_ 1027 #endif // BASE_LOGGING_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698