summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon
diff options
context:
space:
mode:
authorPierre Bourdon <delroth@gmail.com>2015-10-17 03:44:28 +0200
committerPierre Bourdon <delroth@gmail.com>2015-10-17 03:44:28 +0200
commitc0d157e6f6d4e482d7639bc9af05a21090a34ec4 (patch)
treea126081ec302cf22370a1d27a58612833eea1b85 /Source/Core/VideoCommon
parent763f17beaf1a10ce7746fe0232c2c1673fbb0159 (diff)
parent2fc2b82963a5f0e3e212a447c223b2e7bcb5e5e5 (diff)
Merge pull request #3175 from imirkin/master
make gcc check the printf format strings
Diffstat (limited to 'Source/Core/VideoCommon')
-rw-r--r--Source/Core/VideoCommon/PixelShaderGen.cpp2
-rw-r--r--Source/Core/VideoCommon/ShaderGenCommon.h10
-rw-r--r--Source/Core/VideoCommon/VertexShaderGen.cpp4
3 files changed, 11 insertions, 5 deletions
diff --git a/Source/Core/VideoCommon/PixelShaderGen.cpp b/Source/Core/VideoCommon/PixelShaderGen.cpp
index b6b5b7e369..16f24cacb2 100644
--- a/Source/Core/VideoCommon/PixelShaderGen.cpp
+++ b/Source/Core/VideoCommon/PixelShaderGen.cpp
@@ -184,7 +184,7 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T
out.Write("//Pixel Shader for TEV stages\n");
out.Write("//%i TEV stages, %i texgens, %i IND stages\n",
- numStages, numTexgen, bpmem.genMode.numindstages);
+ numStages, numTexgen, bpmem.genMode.numindstages.Value());
uid_data->dstAlphaMode = dstAlphaMode;
uid_data->genMode_numindstages = bpmem.genMode.numindstages;
diff --git a/Source/Core/VideoCommon/ShaderGenCommon.h b/Source/Core/VideoCommon/ShaderGenCommon.h
index 2fd6c51819..ece50e6c38 100644
--- a/Source/Core/VideoCommon/ShaderGenCommon.h
+++ b/Source/Core/VideoCommon/ShaderGenCommon.h
@@ -32,8 +32,11 @@ public:
* Can be used like printf.
* @note In the ShaderCode implementation, this does indeed write the parameter string to an internal buffer. However, you're free to do whatever you like with the parameter.
*/
- template<typename... Args>
- void Write(const char*, Args...) {}
+ void Write(const char*, ...)
+#ifdef __GNUC__
+ __attribute__((format(printf, 2, 3)))
+#endif
+ {}
/*
* Returns a read pointer to the internal buffer.
@@ -116,6 +119,9 @@ public:
}
void Write(const char* fmt, ...)
+#ifdef __GNUC__
+ __attribute__((format(printf, 2, 3)))
+#endif
{
va_list arglist;
va_start(arglist, fmt);
diff --git a/Source/Core/VideoCommon/VertexShaderGen.cpp b/Source/Core/VideoCommon/VertexShaderGen.cpp
index 63f80488e4..fba8fbcbae 100644
--- a/Source/Core/VideoCommon/VertexShaderGen.cpp
+++ b/Source/Core/VideoCommon/VertexShaderGen.cpp
@@ -83,11 +83,11 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ
else
{
// Let's set up attributes
- for (size_t i = 0; i < 8; ++i)
+ for (u32 i = 0; i < 8; ++i)
{
if (i < xfmem.numTexGen.numTexGens)
{
- out.Write("%s out float3 uv%d;\n", GetInterpolationQualifier(api_type), i);
+ out.Write("%s out float3 uv%u;\n", GetInterpolationQualifier(api_type), i);
}
}
out.Write("%s out float4 clipPos;\n", GetInterpolationQualifier(api_type));