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: https://angleproject.googlecode.com/svn/trunk@1259 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 85e4419f
......@@ -42,28 +42,30 @@ namespace gl
#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
......
......@@ -182,7 +182,7 @@ const char *__stdcall eglQueryString(EGLDisplay dpy, EGLint name)
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);
......
......@@ -3801,9 +3801,9 @@ const GLubyte* __stdcall glGetString(GLenum name)
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:
......
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