summaryrefslogtreecommitdiffstats
path: root/source/slang/emit.cpp
diff options
context:
space:
mode:
authorTim Foley <tfoley@nvidia.com>2017-07-06 11:11:01 -0700
committerTim Foley <tfoley@nvidia.com>2017-07-06 11:18:09 -0700
commit03de737f0d18526b99b59a1810c7e290b66f4be2 (patch)
treed0e75b2524d9b7e666de0ca9fa13f3a086bf02dc /source/slang/emit.cpp
parent21a14cb4e0d578bc4f8a460016269a1199cac0da (diff)
Fix many warnings-as-errors issues.
The code should now compile cleanly with warnings as errors for VS2015 with `W3`. Most of the changes had to do with propagating a real pointer-sized integer type through code that had been using `int`.
Diffstat (limited to 'source/slang/emit.cpp')
-rw-r--r--source/slang/emit.cpp37
1 files changed, 12 insertions, 25 deletions
diff --git a/source/slang/emit.cpp b/source/slang/emit.cpp
index 71b39aabb..0b79cb52f 100644
--- a/source/slang/emit.cpp
+++ b/source/slang/emit.cpp
@@ -549,8 +549,8 @@ static void emitSimpleCallExpr(
}
Emit(context, "(");
- int argCount = callExpr->Arguments.Count();
- for (int aa = 0; aa < argCount; ++aa)
+ UInt argCount = callExpr->Arguments.Count();
+ for (UInt aa = 0; aa < argCount; ++aa)
{
if (aa != 0) Emit(context, ", ");
EmitExpr(context, callExpr->Arguments[aa]);
@@ -721,8 +721,8 @@ static void emitCallExpr(
emit(context, name);
Emit(context, "(");
- int argCount = callExpr->Arguments.Count();
- for (int aa = 0; aa < argCount; ++aa)
+ UInt argCount = callExpr->Arguments.Count();
+ for (UInt aa = 0; aa < argCount; ++aa)
{
if (aa != 0) Emit(context, ", ");
EmitExpr(context, callExpr->Arguments[aa]);
@@ -734,7 +734,7 @@ static void emitCallExpr(
{
// General case: we are going to emit some more complex text.
- int argCount = callExpr->Arguments.Count();
+ UInt argCount = callExpr->Arguments.Count();
Emit(context, "(");
@@ -782,8 +782,8 @@ static void emitCallExpr(
Emit(context, "(");
EmitExpr(context, memberExpr->BaseExpression);
Emit(context, ")[");
- int argCount = callExpr->Arguments.Count();
- for (int aa = 0; aa < argCount; ++aa)
+ UInt argCount = callExpr->Arguments.Count();
+ for (UInt aa = 0; aa < argCount; ++aa)
{
if (aa != 0) Emit(context, ", ");
EmitExpr(context, callExpr->Arguments[aa]);
@@ -1483,12 +1483,6 @@ static void EmitType(EmitContext* context, RefPtr<ExpressionType> type, Token co
EmitType(context, type, CodePosition(), nameToken.Content, nameToken.Position);
}
-
-static void EmitType(EmitContext* context, RefPtr<ExpressionType> type, String const& name)
-{
- EmitType(context, type, CodePosition(), name, CodePosition());
-}
-
static void EmitType(EmitContext* context, RefPtr<ExpressionType> type)
{
EmitType(context, type, nullptr);
@@ -1505,13 +1499,6 @@ static void EmitType(EmitContext* context, TypeExp const& typeExp, String const&
EmitType(context, typeExp.type, typeExp.exp->Position, name, CodePosition());
}
-static void EmitType(EmitContext* context, TypeExp const& typeExp)
-{
- advanceToSourceLocation(context, typeExp.exp->Position);
- EmitType(context, typeExp.type, nullptr);
-}
-
-
// Statements
// Emit a statement as a `{}`-enclosed block statement, but avoid adding redundant
@@ -1974,8 +1961,8 @@ static void EmitDeclRef(EmitContext* context, DeclRef<Decl> declRef)
Substitutions* subst = declRef.substitutions.Ptr();
Emit(context, "<");
- int argCount = subst->args.Count();
- for (int aa = 0; aa < argCount; ++aa)
+ UInt argCount = subst->args.Count();
+ for (UInt aa = 0; aa < argCount; ++aa)
{
if (aa != 0) Emit(context, ",");
EmitVal(context, subst->args[aa]);
@@ -2064,7 +2051,7 @@ static void EmitModifiers(EmitContext* context, RefPtr<Decl> decl)
if (argCount != 0)
{
Emit(context, "(");
- for (int aa = 0; aa < argCount; ++aa)
+ for (UInt aa = 0; aa < argCount; ++aa)
{
if (aa != 0) Emit(context, ", ");
EmitExpr(context, args[aa]);
@@ -3025,9 +3012,9 @@ String emitEntryPoint(
// where there were global-scope uniforms.
auto globalScopeLayout = programLayout->globalScopeLayout;
StructTypeLayout* globalStructLayout = nullptr;
- if( auto globalStructLayout = globalScopeLayout.As<StructTypeLayout>() )
+ if( auto gs = globalScopeLayout.As<StructTypeLayout>() )
{
- globalStructLayout = globalStructLayout.Ptr();
+ globalStructLayout = gs.Ptr();
}
else if(auto globalConstantBufferLayout = globalScopeLayout.As<ParameterBlockTypeLayout>())
{