1// Copyright (C) 2011 The Libphonenumber Authors 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15// Author: Philippe Liard 16 17// This file provides a minimalist implementation of common macros. 18 19#ifndef I18N_PHONENUMBERS_BASE_LOGGING_H_ 20#define I18N_PHONENUMBERS_BASE_LOGGING_H_ 21 22#include <cassert> 23 24#if !defined(CHECK_EQ) 25#define CHECK_EQ(X, Y) assert((X) == (Y)) 26#endif 27 28#if !defined(DCHECK) 29#define DCHECK(X) assert(X) 30#define DCHECK_EQ(X, Y) CHECK_EQ((X), (Y)) 31#define DCHECK_GE(X, Y) assert((X) >= (Y)) 32#define DCHECK_GT(X, Y) assert((X) > (Y)) 33#define DCHECK_LT(X, Y) assert((X) < (Y)) 34#endif 35 36template <typename T> T* CHECK_NOTNULL(T* ptr) { 37 assert(ptr); 38 return ptr; 39} 40 41#endif // I18N_PHONENUMBERS_BASE_LOGGING_H_ 42