Wed, 31 Dec 2014 07:16:47 +0100
Revert simplistic fix pending revisit of Mozilla integration attempt.
michael@0 | 1 | // |
michael@0 | 2 | // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved. |
michael@0 | 3 | // Use of this source code is governed by a BSD-style license that can be |
michael@0 | 4 | // found in the LICENSE file. |
michael@0 | 5 | // |
michael@0 | 6 | |
michael@0 | 7 | // compiler_debug.cpp: Debugging utilities. |
michael@0 | 8 | |
michael@0 | 9 | #include "compiler/compiler_debug.h" |
michael@0 | 10 | |
michael@0 | 11 | #include <stdarg.h> |
michael@0 | 12 | #include <stdio.h> |
michael@0 | 13 | |
michael@0 | 14 | #include "compiler/InitializeParseContext.h" |
michael@0 | 15 | #include "compiler/ParseHelper.h" |
michael@0 | 16 | |
michael@0 | 17 | static const int kTraceBufferLen = 1024; |
michael@0 | 18 | |
michael@0 | 19 | #ifdef TRACE_ENABLED |
michael@0 | 20 | extern "C" { |
michael@0 | 21 | void Trace(const char *format, ...) { |
michael@0 | 22 | if (!format) return; |
michael@0 | 23 | |
michael@0 | 24 | TParseContext* parseContext = GetGlobalParseContext(); |
michael@0 | 25 | if (parseContext) { |
michael@0 | 26 | char buf[kTraceBufferLen]; |
michael@0 | 27 | va_list args; |
michael@0 | 28 | va_start(args, format); |
michael@0 | 29 | vsnprintf(buf, kTraceBufferLen, format, args); |
michael@0 | 30 | va_end(args); |
michael@0 | 31 | |
michael@0 | 32 | parseContext->trace(buf); |
michael@0 | 33 | } |
michael@0 | 34 | } |
michael@0 | 35 | } // extern "C" |
michael@0 | 36 | #endif // TRACE_ENABLED |
michael@0 | 37 |