Commit 91b72320 by alokp@chromium.org

Removed the dependency of compiler on common. This is done to make compiler…

Removed the dependency of compiler on common. This is done to make compiler self-sufficient so that it is easier to consume by external developers. I tried to replace all instances of assert by simply redefining assert(x) to ASSERT(x), but was getting a lot of compile errors. I still need to investigate that. Review URL: http://codereview.appspot.com/1461041 git-svn-id: https://angleproject.googlecode.com/svn/trunk@323 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 4e4facd4
......@@ -17,12 +17,11 @@
'glslang_tab_h_file': '<(INTERMEDIATE_DIR)/glslang_tab.h',
},
'sources': [
'common/angleutils.h',
'common/debug.cpp',
'common/debug.h',
'compiler/BaseTypes.h',
'compiler/Common.h',
'compiler/ConstantUnion.h',
'compiler/debug.cpp',
'compiler/debug.h',
'compiler/InfoSink.cpp',
'compiler/InfoSink.h',
'compiler/Initialize.cpp',
......
......@@ -5,8 +5,7 @@
//
#include "compiler/OutputGLSL.h"
#include "common/debug.h"
#include "compiler/debug.h"
namespace
{
......
......@@ -6,8 +6,7 @@
#include "compiler/OutputHLSL.h"
#include "common/debug.h"
#include "compiler/debug.h"
#include "compiler/InfoSink.h"
#include "compiler/UnfoldSelect.h"
......
......@@ -7,9 +7,9 @@
#ifndef _TYPES_INCLUDED
#define _TYPES_INCLUDED
#include <assert.h>
#include "compiler/Common.h"
#include "compiler/BaseTypes.h"
#include "compiler/Common.h"
#include "compiler/debug.h"
//
// Need to have association of line numbers to types in a list for building structs.
......
......@@ -6,8 +6,6 @@
#include "compiler/UnfoldSelect.h"
#include "common/debug.h"
#include "compiler/InfoSink.h"
#include "compiler/OutputHLSL.h"
......
//
// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// debug.cpp: Debugging utilities.
#include "compiler/debug.h"
#include <stdarg.h>
#include "compiler/ParseHelper.h"
static const int kTraceBufferLen = 1024;
#ifdef TRACE_ENABLED
extern "C" {
void Trace(const char *format, ...) {
if (!format) return;
TParseContext* parseContext = GetGlobalParseContext();
if (parseContext) {
char buf[kTraceBufferLen];
va_list args;
va_start(args, format);
vsnprintf(buf, kTraceBufferLen, format, args);
va_end(args);
parseContext->infoSink.debug << buf;
}
}
} // extern "C"
#endif // TRACE_ENABLED
//
// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// debug.h: Debugging utilities.
#ifndef COMPILER_DEBUG_H_
#define COMPILER_DEBUG_H_
#include <assert.h>
#ifdef _DEBUG
#define TRACE_ENABLED // define to enable debug message tracing
#endif // _DEBUG
// Outputs text to the debug log
#ifdef TRACE_ENABLED
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
void Trace(const char* format, ...);
#ifdef __cplusplus
}
#endif // __cplusplus
#else // TRACE_ENABLED
#define Trace ((void)0)
#endif // TRACE_ENABLED
// A macro asserting a condition and outputting failures to the debug log
#define ASSERT(expression) do { \
if(!(expression)) \
Trace("Assert failed: %s(%d): "#expression"\n", __FUNCTION__, __LINE__); \
assert(expression); \
} while(0)
#define UNIMPLEMENTED() do { \
Trace("Unimplemented invoked: %s(%d)\n", __FUNCTION__, __LINE__); \
assert(false); \
} while(0)
#define UNREACHABLE() do { \
Trace("Unreachable reached: %s(%d)\n", __FUNCTION__, __LINE__); \
assert(false); \
} while(0)
#endif // COMPILER_DEBUG_H_
......@@ -32,7 +32,7 @@
#include <errno.h>
#endif // ANGLE_OS_WIN
#include <assert.h>
#include "compiler/debug.h"
//
// Thread Local Storage Operations
......
......@@ -51,11 +51,11 @@ NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// atom.c
//
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "compiler/debug.h"
#include "compiler/preprocessor/slglobals.h"
#undef malloc
......
......@@ -50,7 +50,6 @@ NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// symbols.c
//
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
......
......@@ -50,12 +50,12 @@ NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// tokens.c
//
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "compiler/debug.h"
#include "compiler/preprocessor/slglobals.h"
///////////////////////////////////////////////////////////////////////////////////////////////
......
......@@ -152,6 +152,10 @@
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\debug.cpp"
>
</File>
<File
RelativePath=".\glslang.l"
>
<FileConfiguration
......@@ -324,6 +328,10 @@
>
</File>
<File
RelativePath=".\debug.h"
>
</File>
<File
RelativePath=".\InfoSink.h"
>
</File>
......
......@@ -10,10 +10,9 @@
#include "libGLESv2/Shader.h"
#include "GLSLANG/Shaderlang.h"
#include "compiler/OutputHLSL.h"
#include "common/debug.h"
#include <string>
#include "GLSLANG/Shaderlang.h"
#include "libGLESv2/main.h"
#include "libGLESv2/utilities.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment