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

Side by Side Diff: base/logging.h

Issue 1213193003: Remove DCHECK_IMPLIES and CHECK_IMPLIES (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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/trace_event/memory_dump_manager.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 <cassert> 8 #include <cassert>
9 #include <string> 9 #include <string>
10 #include <cstring> 10 #include <cstring>
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 DEFINE_CHECK_OP_IMPL(GE, >=) 544 DEFINE_CHECK_OP_IMPL(GE, >=)
545 DEFINE_CHECK_OP_IMPL(GT, > ) 545 DEFINE_CHECK_OP_IMPL(GT, > )
546 #undef DEFINE_CHECK_OP_IMPL 546 #undef DEFINE_CHECK_OP_IMPL
547 547
548 #define CHECK_EQ(val1, val2) CHECK_OP(EQ, ==, val1, val2) 548 #define CHECK_EQ(val1, val2) CHECK_OP(EQ, ==, val1, val2)
549 #define CHECK_NE(val1, val2) CHECK_OP(NE, !=, val1, val2) 549 #define CHECK_NE(val1, val2) CHECK_OP(NE, !=, val1, val2)
550 #define CHECK_LE(val1, val2) CHECK_OP(LE, <=, val1, val2) 550 #define CHECK_LE(val1, val2) CHECK_OP(LE, <=, val1, val2)
551 #define CHECK_LT(val1, val2) CHECK_OP(LT, < , val1, val2) 551 #define CHECK_LT(val1, val2) CHECK_OP(LT, < , val1, val2)
552 #define CHECK_GE(val1, val2) CHECK_OP(GE, >=, val1, val2) 552 #define CHECK_GE(val1, val2) CHECK_OP(GE, >=, val1, val2)
553 #define CHECK_GT(val1, val2) CHECK_OP(GT, > , val1, val2) 553 #define CHECK_GT(val1, val2) CHECK_OP(GT, > , val1, val2)
554 #define CHECK_IMPLIES(val1, val2) CHECK(!(val1) || (val2))
555 554
556 #if defined(NDEBUG) 555 #if defined(NDEBUG)
557 #define ENABLE_DLOG 0 556 #define ENABLE_DLOG 0
558 #else 557 #else
559 #define ENABLE_DLOG 1 558 #define ENABLE_DLOG 1
560 #endif 559 #endif
561 560
562 #if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON) 561 #if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON)
563 #define DCHECK_IS_ON() 0 562 #define DCHECK_IS_ON() 0
564 #else 563 #else
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 // WARNING: These may not compile correctly if one of the arguments is a pointer 689 // WARNING: These may not compile correctly if one of the arguments is a pointer
691 // and the other is NULL. To work around this, simply static_cast NULL to the 690 // and the other is NULL. To work around this, simply static_cast NULL to the
692 // type of the desired pointer. 691 // type of the desired pointer.
693 692
694 #define DCHECK_EQ(val1, val2) DCHECK_OP(EQ, ==, val1, val2) 693 #define DCHECK_EQ(val1, val2) DCHECK_OP(EQ, ==, val1, val2)
695 #define DCHECK_NE(val1, val2) DCHECK_OP(NE, !=, val1, val2) 694 #define DCHECK_NE(val1, val2) DCHECK_OP(NE, !=, val1, val2)
696 #define DCHECK_LE(val1, val2) DCHECK_OP(LE, <=, val1, val2) 695 #define DCHECK_LE(val1, val2) DCHECK_OP(LE, <=, val1, val2)
697 #define DCHECK_LT(val1, val2) DCHECK_OP(LT, < , val1, val2) 696 #define DCHECK_LT(val1, val2) DCHECK_OP(LT, < , val1, val2)
698 #define DCHECK_GE(val1, val2) DCHECK_OP(GE, >=, val1, val2) 697 #define DCHECK_GE(val1, val2) DCHECK_OP(GE, >=, val1, val2)
699 #define DCHECK_GT(val1, val2) DCHECK_OP(GT, > , val1, val2) 698 #define DCHECK_GT(val1, val2) DCHECK_OP(GT, > , val1, val2)
700 #define DCHECK_IMPLIES(val1, val2) DCHECK(!(val1) || (val2))
701 699
702 #if !DCHECK_IS_ON() && defined(OS_CHROMEOS) 700 #if !DCHECK_IS_ON() && defined(OS_CHROMEOS)
703 // Implement logging of NOTREACHED() as a dedicated function to get function 701 // Implement logging of NOTREACHED() as a dedicated function to get function
704 // call overhead down to a minimum. 702 // call overhead down to a minimum.
705 void LogErrorNotReached(const char* file, int line); 703 void LogErrorNotReached(const char* file, int line);
706 #define NOTREACHED() \ 704 #define NOTREACHED() \
707 true ? ::logging::LogErrorNotReached(__FILE__, __LINE__) \ 705 true ? ::logging::LogErrorNotReached(__FILE__, __LINE__) \
708 : EAT_STREAM_PARAMETERS 706 : EAT_STREAM_PARAMETERS
709 #else 707 #else
710 #define NOTREACHED() DCHECK(false) 708 #define NOTREACHED() DCHECK(false)
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
930 #elif NOTIMPLEMENTED_POLICY == 5 928 #elif NOTIMPLEMENTED_POLICY == 5
931 #define NOTIMPLEMENTED() do {\ 929 #define NOTIMPLEMENTED() do {\
932 static bool logged_once = false;\ 930 static bool logged_once = false;\
933 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\ 931 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\
934 logged_once = true;\ 932 logged_once = true;\
935 } while(0);\ 933 } while(0);\
936 EAT_STREAM_PARAMETERS 934 EAT_STREAM_PARAMETERS
937 #endif 935 #endif
938 936
939 #endif // BASE_LOGGING_H_ 937 #endif // BASE_LOGGING_H_
OLDNEW
« no previous file with comments | « no previous file | base/trace_event/memory_dump_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698