Commit 60a3d6f7 by Ben Clayton Committed by Ben Clayton

Fix warnings raised during release builds

Bug: b/123933266 Change-Id: If4dc4858c8a81dd5e7b3510a08e7dbae74051483 Reviewed-on: https://swiftshader-review.googlesource.com/c/25556Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Tested-by: 's avatarBen Clayton <bclayton@google.com>
parent 81be8c68
...@@ -2510,10 +2510,10 @@ void Context::readPixels(GLint x, GLint y, GLsizei width, GLsizei height, ...@@ -2510,10 +2510,10 @@ void Context::readPixels(GLint x, GLint y, GLsizei width, GLsizei height,
{ {
for(int i = 0; i < rect.x1 - rect.x0; i++) for(int i = 0; i < rect.x1 - rect.x0; i++)
{ {
float r; float r = 0.f;
float g; float g = 0.f;
float b; float b = 0.f;
float a; float a = 0.f;
switch(renderTarget->getExternalFormat()) switch(renderTarget->getExternalFormat())
{ {
......
...@@ -2104,7 +2104,7 @@ void GetFramebufferAttachmentParameterivOES(GLenum target, GLenum attachment, GL ...@@ -2104,7 +2104,7 @@ void GetFramebufferAttachmentParameterivOES(GLenum target, GLenum attachment, GL
return error(GL_INVALID_ENUM); return error(GL_INVALID_ENUM);
} }
GLenum attachmentObjectType; // Type category GLenum attachmentObjectType = GL_NONE; // Type category
if(attachmentType == GL_NONE_OES || attachmentType == GL_RENDERBUFFER_OES) if(attachmentType == GL_NONE_OES || attachmentType == GL_RENDERBUFFER_OES)
{ {
attachmentObjectType = attachmentType; attachmentObjectType = attachmentType;
......
...@@ -457,6 +457,7 @@ namespace sw ...@@ -457,6 +457,7 @@ namespace sw
default: default:
// Some other random insn. // Some other random insn.
UNIMPLEMENTED("Only types are supported"); UNIMPLEMENTED("Only types are supported");
return 0;
} }
} }
...@@ -789,12 +790,11 @@ namespace sw ...@@ -789,12 +790,11 @@ namespace sw
auto &object = getObject(objectId); auto &object = getObject(objectId);
auto &objectTy = getType(object.type); auto &objectTy = getType(object.type);
auto &pointer = getObject(pointerId); auto &pointer = getObject(pointerId);
auto &pointerTy = getType(pointer.type);
auto &pointerBase = getObject(pointer.pointerBase); auto &pointerBase = getObject(pointer.pointerBase);
auto &pointerBaseTy = getType(pointerBase.type); auto &pointerBaseTy = getType(pointerBase.type);
assert(pointerTy.element == object.type); ASSERT(getType(pointer.type).element == object.type);
assert(TypeID(insn.word(1)) == object.type); ASSERT(TypeID(insn.word(1)) == object.type);
if (pointerBaseTy.storageClass == spv::StorageClassImage || if (pointerBaseTy.storageClass == spv::StorageClassImage ||
pointerBaseTy.storageClass == spv::StorageClassUniform || pointerBaseTy.storageClass == spv::StorageClassUniform ||
...@@ -838,11 +838,10 @@ namespace sw ...@@ -838,11 +838,10 @@ namespace sw
ObjectID baseId = insn.word(3); ObjectID baseId = insn.word(3);
auto &object = getObject(objectId); auto &object = getObject(objectId);
auto &type = getType(typeId); auto &type = getType(typeId);
auto &base = getObject(baseId);
auto &pointerBase = getObject(object.pointerBase); auto &pointerBase = getObject(object.pointerBase);
auto &pointerBaseTy = getType(pointerBase.type); auto &pointerBaseTy = getType(pointerBase.type);
assert(type.sizeInComponents == 1); ASSERT(type.sizeInComponents == 1);
assert(base.pointerBase == object.pointerBase); ASSERT(getObject(baseId).pointerBase == object.pointerBase);
if (pointerBaseTy.storageClass == spv::StorageClassImage || if (pointerBaseTy.storageClass == spv::StorageClassImage ||
pointerBaseTy.storageClass == spv::StorageClassUniform || pointerBaseTy.storageClass == spv::StorageClassUniform ||
......
...@@ -118,6 +118,7 @@ namespace ...@@ -118,6 +118,7 @@ namespace
rr::MutexLock codegenMutex; rr::MutexLock codegenMutex;
#ifdef ENABLE_RR_PRINT
std::string replace(std::string str, const std::string& substr, const std::string& replacement) std::string replace(std::string str, const std::string& substr, const std::string& replacement)
{ {
size_t pos = 0; size_t pos = 0;
...@@ -127,6 +128,7 @@ namespace ...@@ -127,6 +128,7 @@ namespace
} }
return str; return str;
} }
#endif // ENABLE_RR_PRINT
#if REACTOR_LLVM_VERSION >= 7 #if REACTOR_LLVM_VERSION >= 7
llvm::Value *lowerPAVG(llvm::Value *x, llvm::Value *y) llvm::Value *lowerPAVG(llvm::Value *x, llvm::Value *y)
...@@ -7532,7 +7534,7 @@ namespace rr ...@@ -7532,7 +7534,7 @@ namespace rr
} }
#endif // defined(__i386__) || defined(__x86_64__) #endif // defined(__i386__) || defined(__x86_64__)
#if ENABLE_RR_PRINT #ifdef ENABLE_RR_PRINT
// extractAll returns a vector containing the extracted n scalar value of // extractAll returns a vector containing the extracted n scalar value of
// the vector vec. // the vector vec.
static std::vector<Value*> extractAll(Value* vec, int n) static std::vector<Value*> extractAll(Value* vec, int n)
......
...@@ -3077,9 +3077,9 @@ namespace rr ...@@ -3077,9 +3077,9 @@ namespace rr
// args as this appears to still be broken on certain compilers. // args as this appears to still be broken on certain compilers.
#define RR_GET_NTH_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, N, ...) N #define RR_GET_NTH_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, N, ...) N
#define RR_COUNT_ARGUMENTS(...) RR_GET_NTH_ARG(__VA_ARGS__, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) #define RR_COUNT_ARGUMENTS(...) RR_GET_NTH_ARG(__VA_ARGS__, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
static_assert(1 == RR_COUNT_ARGUMENTS(a)); // Sanity checks. static_assert(1 == RR_COUNT_ARGUMENTS(a), "RR_COUNT_ARGUMENTS broken"); // Sanity checks.
static_assert(2 == RR_COUNT_ARGUMENTS(a, b)); static_assert(2 == RR_COUNT_ARGUMENTS(a, b), "RR_COUNT_ARGUMENTS broken");
static_assert(3 == RR_COUNT_ARGUMENTS(a, b, c)); static_assert(3 == RR_COUNT_ARGUMENTS(a, b, c), "RR_COUNT_ARGUMENTS broken");
// RR_WATCH_FMT(...) resolves to a string literal that lists all the // RR_WATCH_FMT(...) resolves to a string literal that lists all the
// arguments by name. This string can be passed to LOG() to print each of // arguments by name. This string can be passed to LOG() to print each of
......
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