Skip to content
Permalink
1fcb3f6417
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
65 lines (45 sloc) 1.58 KB
#pragma once
#ifdef _WIN32
//////////////// On Windows, CRT memory leak detection /////////////
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#ifdef _DEBUG
#ifndef DBG_NEW
#define DBG_NEW new ( _NORMAL_BLOCK , __FILE__ , __LINE__ )
#define new DBG_NEW
#endif
#endif // _DEBUG
// enable dumping memory leaks on Windows
#define DETECT_MEM_LEAKS() \
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF)
#else // Non-Windows systems
// no support for memory leak detection on Non-Windows systems
#define DETECT_MEM_LEAKS()
#endif // _WIN32
#include <cassert>
/*--------- Availability of Google C++ Test Framework ----------*/
// whether using Google C++ Test Framework
#define GTEST 1
#include "test.h"
namespace yasi{
#define CONCAT_DETAIL(x,y) x ## y
#define CONCAT(x,y) CONCAT_DETAIL(x,y)
#define MAKE_UNIQUE(x) CONCAT(x, __COUNTER__ )
#define MAKE_UNIQUE2(x,y) MAKE_UNIQUE( CONCAT(x,y) )
#define MAKE_UNIQUE3(x,y, z) MAKE_UNIQUE2( CONCAT(x,y), z )
#define FREE_SAFE(x) {if( (x) != 0 ) free(x); (x) = 0; }
#define DELETE_SAFE(x) {if( (x) != 0 ) delete (x); (x) = 0; }
#define FREE_SAFE(x) {if( (x) != 0 ) free(x); (x) = 0; }
#define DELETE_ARR_SAFE(x) {if( (x) != 0 ) delete[] (x); (x) = 0; }
#define ARR_LENGTH(x) ( sizeof( (x) )/sizeof( (x)[0] ) )
#define IS_POW_OF_TWO(x) ( ((x) >= 1) && ( ((x) & ((x)-1)) == 0) )
// various types
typedef unsigned int uint;
typedef unsigned char byte;
// Windows specific
#if _WIN32
// disable "inherits via dominance" warning for virtual inheritance diamond cases
#pragma warning( disable : 4250)
#endif
} // namespace yasi