Fixed preprocessors errors on GCC
- Preprocessor variables need to be separated from string constants to be separated token
- Use ##__VA_ARGS__ GCC extension to support empry __VA_ARGS__ (should be no-op on MSVC). See:
http://www.delorie.com/gnu/docs/gcc/gcc_44.html
for details.
The following series fixes compilation on GCC (from mingw-w64) and allows cross compiling the source on Linux. It was tested in Mozilla tree since ANGLE has no support for GCC in its build system.
Issue=358
Signed-off-by: Daniel Koch
git-svn-id: http://angleproject.googlecode.com/svn/trunk@1259 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/common/debug.h b/src/common/debug.h
index 9828ecf..5f8f60f 100644
--- a/src/common/debug.h
+++ b/src/common/debug.h
@@ -42,28 +42,30 @@
#if defined(ANGLE_DISABLE_TRACE) && defined(ANGLE_DISABLE_PERF)
#define TRACE(message, ...) (void(0))
#else
-#define TRACE(message, ...) gl::trace(true, "trace: %s(%d): "message"\n", __FUNCTION__, __LINE__, __VA_ARGS__)
+#define TRACE(message, ...) gl::trace(true, "trace: %s(%d): " message "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__)
#endif
// A macro to output a function call and its arguments to the debugging log, to denote an item in need of fixing.
#if defined(ANGLE_DISABLE_TRACE) && defined(ANGLE_DISABLE_PERF)
#define FIXME(message, ...) (void(0))
#else
-#define FIXME(message, ...) gl::trace(false, "fixme: %s(%d): "message"\n", __FUNCTION__, __LINE__, __VA_ARGS__)
+#define FIXME(message, ...) gl::trace(false, "fixme: %s(%d): " message "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__)
#endif
// A macro to output a function call and its arguments to the debugging log, in case of error.
#if defined(ANGLE_DISABLE_TRACE) && defined(ANGLE_DISABLE_PERF)
#define ERR(message, ...) (void(0))
#else
-#define ERR(message, ...) gl::trace(false, "err: %s(%d): "message"\n", __FUNCTION__, __LINE__, __VA_ARGS__)
+#define ERR(message, ...) gl::trace(false, "err: %s(%d): " message "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__)
#endif
// A macro to log a performance event around a scope.
#if defined(ANGLE_DISABLE_TRACE) && defined(ANGLE_DISABLE_PERF)
#define EVENT(message, ...) (void(0))
-#else
+#elif defined(_MSC_VER)
#define EVENT(message, ...) gl::ScopedPerfEventHelper scopedPerfEventHelper ## __LINE__(__FUNCTION__ message "\n", __VA_ARGS__);
+#else
+#define EVENT(message, ...) gl::ScopedPerfEventHelper scopedPerfEventHelper(message "\n", ##__VA_ARGS__);
#endif
// A macro asserting a condition and outputting failures to the debug log
diff --git a/src/libEGL/libEGL.cpp b/src/libEGL/libEGL.cpp
index 5089d2c..25df1c8 100644
--- a/src/libEGL/libEGL.cpp
+++ b/src/libEGL/libEGL.cpp
@@ -182,7 +182,7 @@
case EGL_VENDOR:
return success("Google Inc.");
case EGL_VERSION:
- return success("1.4 (ANGLE "VERSION_STRING")");
+ return success("1.4 (ANGLE " VERSION_STRING ")");
}
return error(EGL_BAD_PARAMETER, (const char*)NULL);
diff --git a/src/libGLESv2/libGLESv2.cpp b/src/libGLESv2/libGLESv2.cpp
index d48bf76..40a7067 100644
--- a/src/libGLESv2/libGLESv2.cpp
+++ b/src/libGLESv2/libGLESv2.cpp
@@ -3801,9 +3801,9 @@
case GL_RENDERER:
return (GLubyte*)((context != NULL) ? context->getRendererString() : "ANGLE");
case GL_VERSION:
- return (GLubyte*)"OpenGL ES 2.0 (ANGLE "VERSION_STRING")";
+ return (GLubyte*)"OpenGL ES 2.0 (ANGLE " VERSION_STRING ")";
case GL_SHADING_LANGUAGE_VERSION:
- return (GLubyte*)"OpenGL ES GLSL ES 1.00 (ANGLE "VERSION_STRING")";
+ return (GLubyte*)"OpenGL ES GLSL ES 1.00 (ANGLE " VERSION_STRING ")";
case GL_EXTENSIONS:
return (GLubyte*)((context != NULL) ? context->getExtensionString() : "");
default: