1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/angle/src/compiler/compiler_debug.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,53 @@ 1.4 +// 1.5 +// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved. 1.6 +// Use of this source code is governed by a BSD-style license that can be 1.7 +// found in the LICENSE file. 1.8 +// 1.9 + 1.10 +// compiler_debug.h: Debugging utilities. 1.11 + 1.12 +#ifndef COMPILER_DEBUG_H_ 1.13 +#define COMPILER_DEBUG_H_ 1.14 + 1.15 +#include <assert.h> 1.16 + 1.17 +#ifdef _DEBUG 1.18 +#define TRACE_ENABLED // define to enable debug message tracing 1.19 +#endif // _DEBUG 1.20 + 1.21 +// Outputs text to the debug log 1.22 +#ifdef TRACE_ENABLED 1.23 + 1.24 +#ifdef __cplusplus 1.25 +extern "C" { 1.26 +#endif // __cplusplus 1.27 +void Trace(const char* format, ...); 1.28 +#ifdef __cplusplus 1.29 +} 1.30 +#endif // __cplusplus 1.31 + 1.32 +#else // TRACE_ENABLED 1.33 + 1.34 +#define Trace(...) ((void)0) 1.35 + 1.36 +#endif // TRACE_ENABLED 1.37 + 1.38 +// A macro asserting a condition and outputting failures to the debug log 1.39 +#define ASSERT(expression) do { \ 1.40 + if(!(expression)) \ 1.41 + Trace("Assert failed: %s(%d): "#expression"\n", __FUNCTION__, __LINE__); \ 1.42 + assert(expression); \ 1.43 +} while(0) 1.44 + 1.45 +#define UNIMPLEMENTED() do { \ 1.46 + Trace("Unimplemented invoked: %s(%d)\n", __FUNCTION__, __LINE__); \ 1.47 + assert(false); \ 1.48 +} while(0) 1.49 + 1.50 +#define UNREACHABLE() do { \ 1.51 + Trace("Unreachable reached: %s(%d)\n", __FUNCTION__, __LINE__); \ 1.52 + assert(false); \ 1.53 +} while(0) 1.54 + 1.55 +#endif // COMPILER_DEBUG_H_ 1.56 +