Commit 93dfbe13 by John Kessenich

glslang: Fix over 100 warnings from MSVC warning level 4.

parent 2aa7f3a6
...@@ -99,7 +99,7 @@ protected: ...@@ -99,7 +99,7 @@ protected:
spv::Id createUnaryOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId, spv::Id operand, bool isFloat); spv::Id createUnaryOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId, spv::Id operand, bool isFloat);
spv::Id createConversion(glslang::TOperator op, spv::Decoration precision, spv::Id destTypeId, spv::Id operand); spv::Id createConversion(glslang::TOperator op, spv::Decoration precision, spv::Id destTypeId, spv::Id operand);
spv::Id makeSmearedConstant(spv::Id constant, int vectorSize); spv::Id makeSmearedConstant(spv::Id constant, int vectorSize);
spv::Id createMiscOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId, std::vector<spv::Id>& operands, bool isUnsigned); spv::Id createMiscOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId, std::vector<spv::Id>& operands);
spv::Id createNoArgOperation(glslang::TOperator op); spv::Id createNoArgOperation(glslang::TOperator op);
spv::Id getSymbolId(const glslang::TIntermSymbol* node); spv::Id getSymbolId(const glslang::TIntermSymbol* node);
void addDecoration(spv::Id id, spv::Decoration dec); void addDecoration(spv::Id id, spv::Decoration dec);
...@@ -1029,11 +1029,8 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt ...@@ -1029,11 +1029,8 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
result = createUnaryOperation(node->getOp(), precision, convertGlslangToSpvType(node->getType()), operands.front(), node->getType().getBasicType() == glslang::EbtFloat || node->getType().getBasicType() == glslang::EbtDouble); result = createUnaryOperation(node->getOp(), precision, convertGlslangToSpvType(node->getType()), operands.front(), node->getType().getBasicType() == glslang::EbtFloat || node->getType().getBasicType() == glslang::EbtDouble);
break; break;
default: default:
{ result = createMiscOperation(node->getOp(), precision, convertGlslangToSpvType(node->getType()), operands);
const glslang::TType& type = glslangOperands.front()->getAsTyped()->getType(); break;
result = createMiscOperation(node->getOp(), precision, convertGlslangToSpvType(node->getType()), operands, type.getBasicType() == glslang::EbtUint);
break;
}
} }
if (noReturnValue) if (noReturnValue)
...@@ -1271,7 +1268,7 @@ spv::Id TGlslangToSpvTraverser::getSampledType(const glslang::TSampler& sampler) ...@@ -1271,7 +1268,7 @@ spv::Id TGlslangToSpvTraverser::getSampledType(const glslang::TSampler& sampler)
// Do full recursive conversion of an arbitrary glslang type to a SPIR-V Id. // Do full recursive conversion of an arbitrary glslang type to a SPIR-V Id.
spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& type) spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& type)
{ {
spv::Id spvType; spv::Id spvType = 0;
switch (type.getBasicType()) { switch (type.getBasicType()) {
case glslang::EbtVoid: case glslang::EbtVoid:
...@@ -2142,8 +2139,8 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv: ...@@ -2142,8 +2139,8 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv:
spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, spv::Decoration precision, spv::Id destType, spv::Id operand) spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, spv::Decoration precision, spv::Id destType, spv::Id operand)
{ {
spv::Op convOp = spv::OpNop; spv::Op convOp = spv::OpNop;
spv::Id zero; spv::Id zero = 0;
spv::Id one; spv::Id one = 0;
int vectorSize = builder.isVectorType(destType) ? builder.getNumTypeComponents(destType) : 0; int vectorSize = builder.isVectorType(destType) ? builder.getNumTypeComponents(destType) : 0;
...@@ -2246,7 +2243,7 @@ spv::Id TGlslangToSpvTraverser::makeSmearedConstant(spv::Id constant, int vector ...@@ -2246,7 +2243,7 @@ spv::Id TGlslangToSpvTraverser::makeSmearedConstant(spv::Id constant, int vector
return builder.makeCompositeConstant(vectorTypeId, components); return builder.makeCompositeConstant(vectorTypeId, components);
} }
spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId, std::vector<spv::Id>& operands, bool isUnsigned) spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId, std::vector<spv::Id>& operands)
{ {
spv::Op opCode = spv::OpNop; spv::Op opCode = spv::OpNop;
int libCall = -1; int libCall = -1;
...@@ -2502,7 +2499,7 @@ spv::Id TGlslangToSpvTraverser::createSpvConstant(const glslang::TType& glslangT ...@@ -2502,7 +2499,7 @@ spv::Id TGlslangToSpvTraverser::createSpvConstant(const glslang::TType& glslangT
} else { } else {
// we have a non-aggregate (scalar) constant // we have a non-aggregate (scalar) constant
bool zero = nextConst >= consts.size(); bool zero = nextConst >= consts.size();
spv::Id scalar; spv::Id scalar = 0;
switch (glslangType.getBasicType()) { switch (glslangType.getBasicType()) {
case glslang::EbtInt: case glslang::EbtInt:
scalar = builder.makeIntConstant(zero ? 0 : consts[nextConst].getIConst()); scalar = builder.makeIntConstant(zero ? 0 : consts[nextConst].getIConst());
......
...@@ -79,9 +79,9 @@ namespace spv { ...@@ -79,9 +79,9 @@ namespace spv {
class spirvbin_t : public spirvbin_base_t class spirvbin_t : public spirvbin_base_t
{ {
public: public:
spirvbin_t(int verbose = 0) { } spirvbin_t(int /*verbose = 0*/) { }
void remap(std::vector<unsigned int>& spv, unsigned int opts = 0) void remap(std::vector<unsigned int>& /*spv*/, unsigned int /*opts = 0*/)
{ {
printf("Tool not compiled for C++11, which is required for SPIR-V remapping.\n"); printf("Tool not compiled for C++11, which is required for SPIR-V remapping.\n");
} }
......
...@@ -117,7 +117,7 @@ Id Builder::makePointer(StorageClass storageClass, Id pointee) ...@@ -117,7 +117,7 @@ Id Builder::makePointer(StorageClass storageClass, Id pointee)
Instruction* type; Instruction* type;
for (int t = 0; t < (int)groupedTypes[OpTypePointer].size(); ++t) { for (int t = 0; t < (int)groupedTypes[OpTypePointer].size(); ++t) {
type = groupedTypes[OpTypePointer][t]; type = groupedTypes[OpTypePointer][t];
if (type->getImmediateOperand(0) == storageClass && if (type->getImmediateOperand(0) == (unsigned)storageClass &&
type->getIdOperand(1) == pointee) type->getIdOperand(1) == pointee)
return type->getResultId(); return type->getResultId();
} }
...@@ -139,8 +139,8 @@ Id Builder::makeIntegerType(int width, bool hasSign) ...@@ -139,8 +139,8 @@ Id Builder::makeIntegerType(int width, bool hasSign)
Instruction* type; Instruction* type;
for (int t = 0; t < (int)groupedTypes[OpTypeInt].size(); ++t) { for (int t = 0; t < (int)groupedTypes[OpTypeInt].size(); ++t) {
type = groupedTypes[OpTypeInt][t]; type = groupedTypes[OpTypeInt][t];
if (type->getImmediateOperand(0) == width && if (type->getImmediateOperand(0) == (unsigned)width &&
type->getImmediateOperand(1) == (hasSign ? 1 : 0)) type->getImmediateOperand(1) == (hasSign ? 1u : 0u))
return type->getResultId(); return type->getResultId();
} }
...@@ -161,7 +161,7 @@ Id Builder::makeFloatType(int width) ...@@ -161,7 +161,7 @@ Id Builder::makeFloatType(int width)
Instruction* type; Instruction* type;
for (int t = 0; t < (int)groupedTypes[OpTypeFloat].size(); ++t) { for (int t = 0; t < (int)groupedTypes[OpTypeFloat].size(); ++t) {
type = groupedTypes[OpTypeFloat][t]; type = groupedTypes[OpTypeFloat][t];
if (type->getImmediateOperand(0) == width) if (type->getImmediateOperand(0) == (unsigned)width)
return type->getResultId(); return type->getResultId();
} }
...@@ -196,7 +196,7 @@ Id Builder::makeVectorType(Id component, int size) ...@@ -196,7 +196,7 @@ Id Builder::makeVectorType(Id component, int size)
for (int t = 0; t < (int)groupedTypes[OpTypeVector].size(); ++t) { for (int t = 0; t < (int)groupedTypes[OpTypeVector].size(); ++t) {
type = groupedTypes[OpTypeVector][t]; type = groupedTypes[OpTypeVector][t];
if (type->getIdOperand(0) == component && if (type->getIdOperand(0) == component &&
type->getImmediateOperand(1) == size) type->getImmediateOperand(1) == (unsigned)size)
return type->getResultId(); return type->getResultId();
} }
...@@ -222,7 +222,7 @@ Id Builder::makeMatrixType(Id component, int cols, int rows) ...@@ -222,7 +222,7 @@ Id Builder::makeMatrixType(Id component, int cols, int rows)
for (int t = 0; t < (int)groupedTypes[OpTypeMatrix].size(); ++t) { for (int t = 0; t < (int)groupedTypes[OpTypeMatrix].size(); ++t) {
type = groupedTypes[OpTypeMatrix][t]; type = groupedTypes[OpTypeMatrix][t];
if (type->getIdOperand(0) == column && if (type->getIdOperand(0) == column &&
type->getImmediateOperand(1) == cols) type->getImmediateOperand(1) == (unsigned)cols)
return type->getResultId(); return type->getResultId();
} }
...@@ -268,7 +268,7 @@ Id Builder::makeFunctionType(Id returnType, std::vector<Id>& paramTypes) ...@@ -268,7 +268,7 @@ Id Builder::makeFunctionType(Id returnType, std::vector<Id>& paramTypes)
Instruction* type; Instruction* type;
for (int t = 0; t < (int)groupedTypes[OpTypeFunction].size(); ++t) { for (int t = 0; t < (int)groupedTypes[OpTypeFunction].size(); ++t) {
type = groupedTypes[OpTypeFunction][t]; type = groupedTypes[OpTypeFunction][t];
if (type->getIdOperand(0) != returnType || paramTypes.size() != type->getNumOperands() - 1) if (type->getIdOperand(0) != returnType || (int)paramTypes.size() != type->getNumOperands() - 1)
continue; continue;
bool mismatch = false; bool mismatch = false;
for (int p = 0; p < (int)paramTypes.size(); ++p) { for (int p = 0; p < (int)paramTypes.size(); ++p) {
...@@ -547,13 +547,13 @@ Id Builder::makeDoubleConstant(double d) ...@@ -547,13 +547,13 @@ Id Builder::makeDoubleConstant(double d)
Id Builder::findCompositeConstant(Op typeClass, std::vector<Id>& comps) const Id Builder::findCompositeConstant(Op typeClass, std::vector<Id>& comps) const
{ {
Instruction* constant; Instruction* constant = 0;
bool found = false; bool found = false;
for (int i = 0; i < (int)groupedConstants[typeClass].size(); ++i) { for (int i = 0; i < (int)groupedConstants[typeClass].size(); ++i) {
constant = groupedConstants[typeClass][i]; constant = groupedConstants[typeClass][i];
// same shape? // same shape?
if (constant->getNumOperands() != comps.size()) if (constant->getNumOperands() != (int)comps.size())
continue; continue;
// same contents? // same contents?
...@@ -1049,7 +1049,7 @@ void Builder::promoteScalar(Decoration precision, Id& left, Id& right) ...@@ -1049,7 +1049,7 @@ void Builder::promoteScalar(Decoration precision, Id& left, Id& right)
} }
// Comments in header // Comments in header
Id Builder::smearScalar(Decoration precision, Id scalar, Id vectorType) Id Builder::smearScalar(Decoration /*precision*/, Id scalar, Id vectorType)
{ {
assert(getNumComponents(scalar) == 1); assert(getNumComponents(scalar) == 1);
...@@ -1066,7 +1066,7 @@ Id Builder::smearScalar(Decoration precision, Id scalar, Id vectorType) ...@@ -1066,7 +1066,7 @@ Id Builder::smearScalar(Decoration precision, Id scalar, Id vectorType)
} }
// Comments in header // Comments in header
Id Builder::createBuiltinCall(Decoration precision, Id resultType, Id builtins, int entryPoint, std::vector<Id>& args) Id Builder::createBuiltinCall(Decoration /*precision*/, Id resultType, Id builtins, int entryPoint, std::vector<Id>& args)
{ {
Instruction* inst = new Instruction(getUniqueId(), resultType, OpExtInst); Instruction* inst = new Instruction(getUniqueId(), resultType, OpExtInst);
inst->addIdOperand(builtins); inst->addIdOperand(builtins);
...@@ -1259,8 +1259,6 @@ Id Builder::createTextureQueryCall(Op opCode, const TextureParameters& parameter ...@@ -1259,8 +1259,6 @@ Id Builder::createTextureQueryCall(Op opCode, const TextureParameters& parameter
// Comments in header // Comments in header
Id Builder::createCompare(Decoration precision, Id value1, Id value2, bool equal) Id Builder::createCompare(Decoration precision, Id value1, Id value2, bool equal)
{ {
Instruction* compare = 0;
spv::Op binOp = spv::OpNop;
Id boolType = makeBoolType(); Id boolType = makeBoolType();
Id valueType = getTypeId(value1); Id valueType = getTypeId(value1);
...@@ -1461,7 +1459,7 @@ Id Builder::createCompositeConstruct(Id typeId, std::vector<Id>& constituents) ...@@ -1461,7 +1459,7 @@ Id Builder::createCompositeConstruct(Id typeId, std::vector<Id>& constituents)
// Vector or scalar constructor // Vector or scalar constructor
Id Builder::createConstructor(Decoration precision, const std::vector<Id>& sources, Id resultTypeId) Id Builder::createConstructor(Decoration precision, const std::vector<Id>& sources, Id resultTypeId)
{ {
Id result; Id result = 0;
unsigned int numTargetComponents = getNumTypeComponents(resultTypeId); unsigned int numTargetComponents = getNumTypeComponents(resultTypeId);
unsigned int targetComponent = 0; unsigned int targetComponent = 0;
...@@ -1701,7 +1699,7 @@ void Builder::nextSwitchSegment(std::vector<Block*>& segmentBlock, int nextSegme ...@@ -1701,7 +1699,7 @@ void Builder::nextSwitchSegment(std::vector<Block*>& segmentBlock, int nextSegme
} }
// Comments in header // Comments in header
void Builder::endSwitch(std::vector<Block*>& segmentBlock) void Builder::endSwitch(std::vector<Block*>& /*segmentBlock*/)
{ {
// Close out previous segment by jumping, if necessary, to next segment // Close out previous segment by jumping, if necessary, to next segment
if (! buildPoint->isTerminated()) if (! buildPoint->isTerminated())
...@@ -1840,7 +1838,7 @@ void Builder::accessChainStore(Id rvalue) ...@@ -1840,7 +1838,7 @@ void Builder::accessChainStore(Id rvalue)
} }
// Comments in header // Comments in header
Id Builder::accessChainLoad(Decoration precision) Id Builder::accessChainLoad(Decoration /*precision*/)
{ {
Id id; Id id;
...@@ -1991,7 +1989,7 @@ void Builder::simplifyAccessChainSwizzle() ...@@ -1991,7 +1989,7 @@ void Builder::simplifyAccessChainSwizzle()
// Utility method for creating a new block and setting the insert point to // Utility method for creating a new block and setting the insert point to
// be in it. This is useful for flow-control operations that need a "dummy" // be in it. This is useful for flow-control operations that need a "dummy"
// block proceeding them (e.g. instructions after a discard, etc). // block proceeding them (e.g. instructions after a discard, etc).
void Builder::createAndSetNoPredecessorBlock(const char* name) void Builder::createAndSetNoPredecessorBlock(const char* /*name*/)
{ {
Block* block = new Block(getUniqueId(), buildPoint->getParent()); Block* block = new Block(getUniqueId(), buildPoint->getParent());
block->setUnreachable(); block->setUnreachable();
......
...@@ -101,7 +101,7 @@ public: ...@@ -101,7 +101,7 @@ public:
Id makeMatrixType(Id component, int cols, int rows); Id makeMatrixType(Id component, int cols, int rows);
Id makeArrayType(Id element, unsigned size); Id makeArrayType(Id element, unsigned size);
Id makeFunctionType(Id returnType, std::vector<Id>& paramTypes); Id makeFunctionType(Id returnType, std::vector<Id>& paramTypes);
enum samplerContent { enum samplerContent : unsigned {
samplerContentTexture, samplerContentTexture,
samplerContentImage, samplerContentImage,
samplerContentTextureFilter samplerContentTextureFilter
...@@ -250,7 +250,7 @@ public: ...@@ -250,7 +250,7 @@ public:
// If the value passed in is an instruction and the precision is not EMpNone, // If the value passed in is an instruction and the precision is not EMpNone,
// it gets tagged with the requested precision. // it gets tagged with the requested precision.
void setPrecision(Id value, Decoration precision) void setPrecision(Id /* value */, Decoration /* precision */)
{ {
// TODO // TODO
} }
...@@ -318,6 +318,9 @@ public: ...@@ -318,6 +318,9 @@ public:
void makeEndIf(); void makeEndIf();
private: private:
If(const If&);
If& operator=(If&);
Builder& builder; Builder& builder;
Id condition; Id condition;
Function* function; Function* function;
......
...@@ -70,6 +70,9 @@ public: ...@@ -70,6 +70,9 @@ public:
void processInstructions(); void processInstructions();
protected: protected:
SpirvStream(SpirvStream&);
SpirvStream& operator=(SpirvStream&);
Op getOpCode(int id) const { return idInstruction[id] ? (Op)(stream[idInstruction[id]] & OpCodeMask) : OpNop; } Op getOpCode(int id) const { return idInstruction[id] ? (Op)(stream[idInstruction[id]] & OpCodeMask) : OpNop; }
// Output methods // Output methods
...@@ -278,7 +281,7 @@ void SpirvStream::disassembleString() ...@@ -278,7 +281,7 @@ void SpirvStream::disassembleString()
out << "\""; out << "\"";
} }
void SpirvStream::disassembleInstruction(Id resultId, Id typeId, Op opCode, int numOperands) void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode, int numOperands)
{ {
// Process the opcode // Process the opcode
......
...@@ -210,6 +210,7 @@ public: ...@@ -210,6 +210,7 @@ public:
protected: protected:
Block(const Block&); Block(const Block&);
Block& operator=(Block&);
// To enforce keeping parent and ownership in sync: // To enforce keeping parent and ownership in sync:
friend Function; friend Function;
...@@ -244,7 +245,7 @@ public: ...@@ -244,7 +245,7 @@ public:
Id getParamId(int p) { return parameterInstructions[p]->getResultId(); } Id getParamId(int p) { return parameterInstructions[p]->getResultId(); }
void addBlock(Block* block) { blocks.push_back(block); } void addBlock(Block* block) { blocks.push_back(block); }
void popBlock(Block* block) { assert(blocks.back() == block); blocks.pop_back(); } void popBlock(Block*) { blocks.pop_back(); }
Module& getParent() const { return parent; } Module& getParent() const { return parent; }
Block* getEntryBlock() const { return blocks.front(); } Block* getEntryBlock() const { return blocks.front(); }
...@@ -269,6 +270,8 @@ public: ...@@ -269,6 +270,8 @@ public:
protected: protected:
Function(const Function&); Function(const Function&);
Function& operator=(Function&);
Module& parent; Module& parent;
Instruction functionInstruction; Instruction functionInstruction;
std::vector<Instruction*> parameterInstructions; std::vector<Instruction*> parameterInstructions;
......
...@@ -938,7 +938,7 @@ char** ReadFileData(const char* fileName) ...@@ -938,7 +938,7 @@ char** ReadFileData(const char* fileName)
printf("Error allocating memory\n"); printf("Error allocating memory\n");
return 0; return 0;
} }
if (fread(fdata,1,count, in)!=count) { if ((int)fread(fdata,1,count, in) != count) {
printf("Error reading input file: %s\n", fileName); printf("Error reading input file: %s\n", fileName);
return 0; return 0;
} }
......
...@@ -68,7 +68,7 @@ void DeleteCompiler(TCompiler* compiler) ...@@ -68,7 +68,7 @@ void DeleteCompiler(TCompiler* compiler)
// //
// Generate code from the given parse tree // Generate code from the given parse tree
// //
bool TGenericCompiler::compile(TIntermNode *root, int version, EProfile profile) bool TGenericCompiler::compile(TIntermNode* /*root*/, int /*version*/, EProfile /*profile*/)
{ {
haveValidObjectCode = true; haveValidObjectCode = true;
......
...@@ -46,7 +46,7 @@ class TGenericLinker : public TLinker { ...@@ -46,7 +46,7 @@ class TGenericLinker : public TLinker {
public: public:
TGenericLinker(EShExecutable e, int dOptions) : TLinker(e, infoSink), debugOptions(dOptions) { } TGenericLinker(EShExecutable e, int dOptions) : TLinker(e, infoSink), debugOptions(dOptions) { }
bool link(TCompilerList&, TUniformMap*) { return true; } bool link(TCompilerList&, TUniformMap*) { return true; }
void getAttributeBindings(ShBindingTable const **t) const { } void getAttributeBindings(ShBindingTable const **) const { }
TInfoSink infoSink; TInfoSink infoSink;
int debugOptions; int debugOptions;
}; };
...@@ -57,7 +57,7 @@ public: ...@@ -57,7 +57,7 @@ public:
class TUniformLinkedMap : public TUniformMap { class TUniformLinkedMap : public TUniformMap {
public: public:
TUniformLinkedMap() { } TUniformLinkedMap() { }
virtual int getLocation(const char* name) { return 0; } virtual int getLocation(const char*) { return 0; }
}; };
TShHandleBase* ConstructLinker(EShExecutable executable, int debugOptions) TShHandleBase* ConstructLinker(EShExecutable executable, int debugOptions)
......
...@@ -185,8 +185,6 @@ public: ...@@ -185,8 +185,6 @@ public:
assert(false && "Default missing"); assert(false && "Default missing");
return false; return false;
} }
return false;
} }
bool operator<(const TConstUnion& constant) const bool operator<(const TConstUnion& constant) const
...@@ -212,8 +210,6 @@ public: ...@@ -212,8 +210,6 @@ public:
assert(false && "Default missing"); assert(false && "Default missing");
return false; return false;
} }
return false;
} }
TConstUnion operator+(const TConstUnion& constant) const TConstUnion operator+(const TConstUnion& constant) const
......
...@@ -214,11 +214,13 @@ protected: ...@@ -214,11 +214,13 @@ protected:
typedef std::vector<tAllocState> tAllocStack; typedef std::vector<tAllocState> tAllocStack;
// Track allocations if and only if we're using guard blocks // Track allocations if and only if we're using guard blocks
#ifndef GUARD_BLOCKS
void* initializeAllocation(tHeader*, unsigned char* memory, size_t) {
#else
void* initializeAllocation(tHeader* block, unsigned char* memory, size_t numBytes) { void* initializeAllocation(tHeader* block, unsigned char* memory, size_t numBytes) {
# ifdef GUARD_BLOCKS
new(memory) TAllocation(numBytes, memory, block->lastAllocation); new(memory) TAllocation(numBytes, memory, block->lastAllocation);
block->lastAllocation = reinterpret_cast<TAllocation*>(memory); block->lastAllocation = reinterpret_cast<TAllocation*>(memory);
# endif #endif
// This is optimized entirely away if GUARD_BLOCKS is not defined. // This is optimized entirely away if GUARD_BLOCKS is not defined.
return TAllocation::offsetAllocation(memory); return TAllocation::offsetAllocation(memory);
...@@ -314,7 +316,7 @@ public: ...@@ -314,7 +316,7 @@ public:
TPoolAllocator& getAllocator() const { return allocator; } TPoolAllocator& getAllocator() const { return allocator; }
protected: protected:
pool_allocator& operator=(const pool_allocator& rhs) { return *this; } pool_allocator& operator=(const pool_allocator&) { return *this; }
TPoolAllocator& allocator; TPoolAllocator& allocator;
}; };
......
...@@ -98,6 +98,8 @@ public: ...@@ -98,6 +98,8 @@ public:
TInfoSink& infoSink; TInfoSink& infoSink;
protected: protected:
TCompiler& operator=(TCompiler&);
EShLanguage language; EShLanguage language;
bool haveValidObjectCode; bool haveValidObjectCode;
}; };
...@@ -137,6 +139,7 @@ public: ...@@ -137,6 +139,7 @@ public:
virtual TInfoSink& getInfoSink() { return infoSink; } virtual TInfoSink& getInfoSink() { return infoSink; }
TInfoSink& infoSink; TInfoSink& infoSink;
protected: protected:
TLinker& operator=(TLinker&);
EShExecutable executable; EShExecutable executable;
bool haveReturnableObjectCode; // true when objectCode is acceptable to send to driver bool haveReturnableObjectCode; // true when objectCode is acceptable to send to driver
......
...@@ -694,15 +694,15 @@ public: ...@@ -694,15 +694,15 @@ public:
maxDepth(0) { } maxDepth(0) { }
virtual ~TIntermTraverser() { } virtual ~TIntermTraverser() { }
virtual void visitSymbol(TIntermSymbol*) { } virtual void visitSymbol(TIntermSymbol*) { }
virtual void visitConstantUnion(TIntermConstantUnion*) { } virtual void visitConstantUnion(TIntermConstantUnion*) { }
virtual bool visitBinary(TVisit visit, TIntermBinary*) { return true; } virtual bool visitBinary(TVisit, TIntermBinary*) { return true; }
virtual bool visitUnary(TVisit visit, TIntermUnary*) { return true; } virtual bool visitUnary(TVisit, TIntermUnary*) { return true; }
virtual bool visitSelection(TVisit visit, TIntermSelection*) { return true; } virtual bool visitSelection(TVisit, TIntermSelection*) { return true; }
virtual bool visitAggregate(TVisit visit, TIntermAggregate*) { return true; } virtual bool visitAggregate(TVisit, TIntermAggregate*) { return true; }
virtual bool visitLoop(TVisit visit, TIntermLoop*) { return true; } virtual bool visitLoop(TVisit, TIntermLoop*) { return true; }
virtual bool visitBranch(TVisit visit, TIntermBranch*) { return true; } virtual bool visitBranch(TVisit, TIntermBranch*) { return true; }
virtual bool visitSwitch(TVisit, TIntermSwitch* node) { return true; } virtual bool visitSwitch(TVisit, TIntermSwitch*) { return true; }
int getMaxDepth() const { return maxDepth; } int getMaxDepth() const { return maxDepth; }
...@@ -730,6 +730,8 @@ public: ...@@ -730,6 +730,8 @@ public:
const bool rightToLeft; const bool rightToLeft;
protected: protected:
TIntermTraverser& operator=(TIntermTraverser&);
int depth; int depth;
int maxDepth; int maxDepth;
......
...@@ -646,10 +646,10 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode) ...@@ -646,10 +646,10 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode)
// some arguments are scalars instead of matching vectors; simulate a smear // some arguments are scalars instead of matching vectors; simulate a smear
int arg0comp = std::min(comp, children[0]->getAsTyped()->getType().getVectorSize() - 1); int arg0comp = std::min(comp, children[0]->getAsTyped()->getType().getVectorSize() - 1);
int arg1comp; int arg1comp = 0;
if (children.size() > 1) if (children.size() > 1)
arg1comp = std::min(comp, children[1]->getAsTyped()->getType().getVectorSize() - 1); arg1comp = std::min(comp, children[1]->getAsTyped()->getType().getVectorSize() - 1);
int arg2comp; int arg2comp = 0;
if (children.size() > 2) if (children.size() > 2)
arg2comp = std::min(comp, children[2]->getAsTyped()->getType().getVectorSize() - 1); arg2comp = std::min(comp, children[2]->getAsTyped()->getType().getVectorSize() - 1);
......
...@@ -1951,7 +1951,7 @@ void TBuiltIns::addImageFunctions(TSampler sampler, TString& typeName, int versi ...@@ -1951,7 +1951,7 @@ void TBuiltIns::addImageFunctions(TSampler sampler, TString& typeName, int versi
// //
// Add all the texture lookup functions for the given type. // Add all the texture lookup functions for the given type.
// //
void TBuiltIns::addSamplingFunctions(TSampler sampler, TString& typeName, int version, EProfile profile) void TBuiltIns::addSamplingFunctions(TSampler sampler, TString& typeName, int /*version*/, EProfile /*profile*/)
{ {
// //
// texturing // texturing
......
...@@ -56,7 +56,7 @@ namespace glslang { ...@@ -56,7 +56,7 @@ namespace glslang {
// //
// Traversal functions for terminals are straighforward.... // Traversal functions for terminals are straighforward....
// //
void TIntermMethod::traverse(TIntermTraverser* it) void TIntermMethod::traverse(TIntermTraverser*)
{ {
// Tree should always resolve all methods as a non-method. // Tree should always resolve all methods as a non-method.
} }
......
...@@ -891,7 +891,7 @@ TIntermBranch* TIntermediate::addBranch(TOperator branchOp, TIntermTyped* expres ...@@ -891,7 +891,7 @@ TIntermBranch* TIntermediate::addBranch(TOperator branchOp, TIntermTyped* expres
// This is to be executed after the final root is put on top by the parsing // This is to be executed after the final root is put on top by the parsing
// process. // process.
// //
bool TIntermediate::postProcess(TIntermNode* root, EShLanguage language) bool TIntermediate::postProcess(TIntermNode* root, EShLanguage /*language*/)
{ {
if (root == 0) if (root == 0)
return true; return true;
...@@ -968,7 +968,7 @@ void TIntermediate::addSymbolLinkageNode(TIntermAggregate*& linkage, const TSymb ...@@ -968,7 +968,7 @@ void TIntermediate::addSymbolLinkageNode(TIntermAggregate*& linkage, const TSymb
// Add a caller->callee relationship to the call graph. // Add a caller->callee relationship to the call graph.
// Assumes the strings are unique per signature. // Assumes the strings are unique per signature.
// //
void TIntermediate::addToCallGraph(TInfoSink& infoSink, const TString& caller, const TString& callee) void TIntermediate::addToCallGraph(TInfoSink& /*infoSink*/, const TString& caller, const TString& callee)
{ {
// Duplicates are okay, but faster to not keep them, and they come grouped by caller, // Duplicates are okay, but faster to not keep them, and they come grouped by caller,
// as long as new ones are push on the same end we check on for duplicates // as long as new ones are push on the same end we check on for duplicates
......
...@@ -160,7 +160,7 @@ public: ...@@ -160,7 +160,7 @@ public:
void setLayoutQualifier(TSourceLoc, TPublicType&, TString&); void setLayoutQualifier(TSourceLoc, TPublicType&, TString&);
void setLayoutQualifier(TSourceLoc, TPublicType&, TString&, const TIntermTyped*); void setLayoutQualifier(TSourceLoc, TPublicType&, TString&, const TIntermTyped*);
void mergeObjectLayoutQualifiers(TSourceLoc, TQualifier& dest, const TQualifier& src, bool inheritOnly); void mergeObjectLayoutQualifiers(TQualifier& dest, const TQualifier& src, bool inheritOnly);
void layoutObjectCheck(TSourceLoc, const TSymbol&); void layoutObjectCheck(TSourceLoc, const TSymbol&);
void layoutTypeCheck(TSourceLoc, const TType&); void layoutTypeCheck(TSourceLoc, const TType&);
void layoutQualifierCheck(TSourceLoc, const TQualifier&); void layoutQualifierCheck(TSourceLoc, const TQualifier&);
...@@ -178,8 +178,8 @@ public: ...@@ -178,8 +178,8 @@ public:
TIntermTyped* constructBuiltIn(const TType&, TOperator, TIntermTyped*, TSourceLoc, bool subset); TIntermTyped* constructBuiltIn(const TType&, TOperator, TIntermTyped*, TSourceLoc, bool subset);
void declareBlock(TSourceLoc, TTypeList& typeList, const TString* instanceName = 0, TArraySizes* arraySizes = 0); void declareBlock(TSourceLoc, TTypeList& typeList, const TString* instanceName = 0, TArraySizes* arraySizes = 0);
void fixBlockLocations(TSourceLoc, TQualifier&, TTypeList&, bool memberWithLocation, bool memberWithoutLocation); void fixBlockLocations(TSourceLoc, TQualifier&, TTypeList&, bool memberWithLocation, bool memberWithoutLocation);
void fixBlockXfbOffsets(TSourceLoc, TQualifier&, TTypeList&); void fixBlockXfbOffsets(TQualifier&, TTypeList&);
void fixBlockUniformOffsets(TSourceLoc, TQualifier&, TTypeList&); void fixBlockUniformOffsets(TQualifier&, TTypeList&);
void addQualifierToExisting(TSourceLoc, TQualifier, const TString& identifier); void addQualifierToExisting(TSourceLoc, TQualifier, const TString& identifier);
void addQualifierToExisting(TSourceLoc, TQualifier, TIdentifierList&); void addQualifierToExisting(TSourceLoc, TQualifier, TIdentifierList&);
void invariantCheck(TSourceLoc, const TQualifier&); void invariantCheck(TSourceLoc, const TQualifier&);
...@@ -221,7 +221,7 @@ protected: ...@@ -221,7 +221,7 @@ protected:
TVariable* makeInternalVariable(const char* name, const TType&) const; TVariable* makeInternalVariable(const char* name, const TType&) const;
TVariable* declareNonArray(TSourceLoc, TString& identifier, TType&, bool& newDeclaration); TVariable* declareNonArray(TSourceLoc, TString& identifier, TType&, bool& newDeclaration);
void declareArray(TSourceLoc, TString& identifier, const TType&, TSymbol*&, bool& newDeclaration); void declareArray(TSourceLoc, TString& identifier, const TType&, TSymbol*&, bool& newDeclaration);
TIntermNode* executeInitializer(TSourceLoc, TString& identifier, TIntermTyped* initializer, TVariable* variable); TIntermNode* executeInitializer(TSourceLoc, TIntermTyped* initializer, TVariable* variable);
TIntermTyped* convertInitializerList(TSourceLoc, const TType&, TIntermTyped* initializer); TIntermTyped* convertInitializerList(TSourceLoc, const TType&, TIntermTyped* initializer);
TOperator mapTypeToConstructorOp(const TType&) const; TOperator mapTypeToConstructorOp(const TType&) const;
void finalErrorCheck(); void finalErrorCheck();
...@@ -263,6 +263,9 @@ public: ...@@ -263,6 +263,9 @@ public:
TLimits& limits; TLimits& limits;
protected: protected:
TParseContext(TParseContext&);
TParseContext& operator=(TParseContext&);
TScanContext* scanContext; TScanContext* scanContext;
TPpContext* ppContext; TPpContext* ppContext;
TInputScanner* currentScanner; TInputScanner* currentScanner;
......
...@@ -183,7 +183,11 @@ const unsigned char TAllocation::userDataFill = 0xcd; ...@@ -183,7 +183,11 @@ const unsigned char TAllocation::userDataFill = 0xcd;
// //
// Check a single guard block for damage // Check a single guard block for damage
// //
#ifdef GUARD_BLOCKS
void TAllocation::checkGuardBlock(unsigned char* blockMem, unsigned char val, const char* locText) const void TAllocation::checkGuardBlock(unsigned char* blockMem, unsigned char val, const char* locText) const
#else
void TAllocation::checkGuardBlock(unsigned char*, unsigned char, const char*) const
#endif
{ {
#ifdef GUARD_BLOCKS #ifdef GUARD_BLOCKS
for (int x = 0; x < guardBlockSize; x++) { for (int x = 0; x < guardBlockSize; x++) {
......
...@@ -249,7 +249,7 @@ bool TInputScanner::scanVersion(int& version, EProfile& profile, bool& notFirstT ...@@ -249,7 +249,7 @@ bool TInputScanner::scanVersion(int& version, EProfile& profile, bool& notFirstT
for (profileLength = 0; profileLength < maxProfileLength; ++profileLength) { for (profileLength = 0; profileLength < maxProfileLength; ++profileLength) {
if (c < 0 || c == ' ' || c == '\t' || c == '\n' || c == '\r') if (c < 0 || c == ' ' || c == '\t' || c == '\n' || c == '\r')
break; break;
profileString[profileLength] = c; profileString[profileLength] = (char)c;
c = get(); c = get();
} }
if (c > 0 && c != ' ' && c != '\t' && c != '\n' && c != '\r') { if (c > 0 && c != ' ' && c != '\t' && c != '\n' && c != '\r') {
...@@ -274,6 +274,9 @@ public: ...@@ -274,6 +274,9 @@ public:
explicit TParserToken(YYSTYPE& b) : sType(b) { } explicit TParserToken(YYSTYPE& b) : sType(b) { }
YYSTYPE& sType; YYSTYPE& sType;
protected:
TParserToken(TParserToken&);
TParserToken& operator=(TParserToken&);
}; };
} // end namespace glslang } // end namespace glslang
...@@ -594,7 +597,7 @@ int TScanContext::tokenize(TPpContext* pp, TParserToken& token) ...@@ -594,7 +597,7 @@ int TScanContext::tokenize(TPpContext* pp, TParserToken& token)
default: default:
char buf[2]; char buf[2];
buf[0] = ppToken.token; buf[0] = (char)ppToken.token;
buf[1] = 0; buf[1] = 0;
parseContext.error(loc, "unexpected token", buf, ""); parseContext.error(loc, "unexpected token", buf, "");
break; break;
......
...@@ -57,6 +57,9 @@ public: ...@@ -57,6 +57,9 @@ public:
int tokenize(TPpContext*, TParserToken&); int tokenize(TPpContext*, TParserToken&);
protected: protected:
TScanContext(TScanContext&);
TScanContext& operator=(TScanContext&);
int tokenizeIdentifier(); int tokenizeIdentifier();
int identifierOrType(); int identifierOrType();
int reservedWord(); int reservedWord();
......
...@@ -688,7 +688,7 @@ int ShCompile( ...@@ -688,7 +688,7 @@ int ShCompile(
const int* inputLengths, const int* inputLengths,
const EShOptimizationLevel optLevel, const EShOptimizationLevel optLevel,
const TBuiltInResource* resources, const TBuiltInResource* resources,
int debugOptions, // currently unused int /*debugOptions*/,
int defaultVersion, // use 100 for ES environment, 110 for desktop int defaultVersion, // use 100 for ES environment, 110 for desktop
bool forwardCompatible, // give errors for use of deprecated features bool forwardCompatible, // give errors for use of deprecated features
EShMessages messages // warnings/errors/AST; things to print out EShMessages messages // warnings/errors/AST; things to print out
...@@ -730,36 +730,6 @@ int ShCompile( ...@@ -730,36 +730,6 @@ int ShCompile(
// Return: The return value of is really boolean, indicating // Return: The return value of is really boolean, indicating
// success or failure. // success or failure.
// //
int ShLink(
const ShHandle linkHandle,
const ShHandle compHandles[],
const int numHandles,
ShHandle uniformMapHandle,
short int** uniformsAccessed,
int* numUniformsAccessed)
{
if (!InitThread())
return 0;
TShHandleBase* base = reinterpret_cast<TShHandleBase*>(linkHandle);
TLinker* linker = static_cast<TLinker*>(base->getAsLinker());
if (linker == 0)
return 0;
int returnValue;
GetThreadPoolAllocator().push();
returnValue = ShLinkExt(linkHandle, compHandles, numHandles);
GetThreadPoolAllocator().pop();
if (returnValue)
return 1;
return 0;
}
//
// This link method will be eventually used once the ICD supports the new linker interface
//
int ShLinkExt( int ShLinkExt(
const ShHandle linkHandle, const ShHandle linkHandle,
const ShHandle compHandles[], const ShHandle compHandles[],
...@@ -835,6 +805,8 @@ const char* ShGetInfoLog(const ShHandle handle) ...@@ -835,6 +805,8 @@ const char* ShGetInfoLog(const ShHandle handle)
infoSink = &(base->getAsCompiler()->getInfoSink()); infoSink = &(base->getAsCompiler()->getInfoSink());
else if (base->getAsLinker()) else if (base->getAsLinker())
infoSink = &(base->getAsLinker()->getInfoSink()); infoSink = &(base->getAsLinker()->getInfoSink());
else
return 0;
infoSink->info << infoSink->debug.c_str(); infoSink->info << infoSink->debug.c_str();
return infoSink->info.c_str(); return infoSink->info.c_str();
...@@ -990,7 +962,7 @@ void FinalizeProcess() ...@@ -990,7 +962,7 @@ void FinalizeProcess()
class TDeferredCompiler : public TCompiler { class TDeferredCompiler : public TCompiler {
public: public:
TDeferredCompiler(EShLanguage s, TInfoSink& i) : TCompiler(s, i) { } TDeferredCompiler(EShLanguage s, TInfoSink& i) : TCompiler(s, i) { }
virtual bool compile(TIntermNode* root, int version = 0, EProfile profile = ENoProfile) { return true; } virtual bool compile(TIntermNode*, int = 0, EProfile = ENoProfile) { return true; }
}; };
TShader::TShader(EShLanguage s) TShader::TShader(EShLanguage s)
......
...@@ -1027,7 +1027,7 @@ layout_qualifier_id_list ...@@ -1027,7 +1027,7 @@ layout_qualifier_id_list
| layout_qualifier_id_list COMMA layout_qualifier_id { | layout_qualifier_id_list COMMA layout_qualifier_id {
$$ = $1; $$ = $1;
$$.shaderQualifiers.merge($3.shaderQualifiers); $$.shaderQualifiers.merge($3.shaderQualifiers);
parseContext.mergeObjectLayoutQualifiers($2.loc, $$.qualifier, $3.qualifier, false); parseContext.mergeObjectLayoutQualifiers($$.qualifier, $3.qualifier, false);
} }
layout_qualifier_id layout_qualifier_id
......
...@@ -67,6 +67,9 @@ public: ...@@ -67,6 +67,9 @@ public:
virtual bool visitSwitch(TVisit, TIntermSwitch* node); virtual bool visitSwitch(TVisit, TIntermSwitch* node);
TInfoSink& infoSink; TInfoSink& infoSink;
protected:
TOutputTraverser(TOutputTraverser&);
TOutputTraverser& operator=(TOutputTraverser&);
}; };
// //
......
...@@ -74,6 +74,10 @@ public: ...@@ -74,6 +74,10 @@ public:
TSymbolTable& symbolTable; TSymbolTable& symbolTable;
bool bad; bool bad;
TSourceLoc badLoc; TSourceLoc badLoc;
protected:
TInductiveTraverser(TInductiveTraverser&);
TInductiveTraverser& operator=(TInductiveTraverser&);
}; };
// check binary operations for those modifying the loop index // check binary operations for those modifying the loop index
...@@ -152,6 +156,10 @@ public: ...@@ -152,6 +156,10 @@ public:
const TIdSetType& inductiveLoopIds; const TIdSetType& inductiveLoopIds;
bool bad; bool bad;
TSourceLoc badLoc; TSourceLoc badLoc;
protected:
TIndexTraverser(TIndexTraverser&);
TIndexTraverser& operator=(TIndexTraverser&);
}; };
// make sure symbols are inductive-loop indexes // make sure symbols are inductive-loop indexes
......
...@@ -285,7 +285,7 @@ public: ...@@ -285,7 +285,7 @@ public:
int addUsedOffsets(int binding, int offset, int numOffsets); int addUsedOffsets(int binding, int offset, int numOffsets);
int computeTypeLocationSize(const TType&) const; int computeTypeLocationSize(const TType&) const;
bool setXfbBufferStride(int buffer, int stride) bool setXfbBufferStride(int buffer, unsigned stride)
{ {
if (xfbBuffers[buffer].stride != TQualifier::layoutXfbStrideEnd) if (xfbBuffers[buffer].stride != TQualifier::layoutXfbStrideEnd)
return xfbBuffers[buffer].stride == stride; return xfbBuffers[buffer].stride == stride;
......
...@@ -62,6 +62,10 @@ public: ...@@ -62,6 +62,10 @@ public:
bool isMatrix; bool isMatrix;
int matrixCols; int matrixCols;
int matrixRows; int matrixRows;
protected:
TConstTraverser(TConstTraverser&);
TConstTraverser& operator=(TConstTraverser&);
}; };
bool TConstTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node) bool TConstTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node)
......
...@@ -454,8 +454,8 @@ int TPpContext::eval(int token, int precedence, bool shortCircuit, int& res, boo ...@@ -454,8 +454,8 @@ int TPpContext::eval(int token, int precedence, bool shortCircuit, int& res, boo
return token; return token;
} }
Symbol* s; Symbol* s = LookUpSymbol(ppToken->atom);
res = (s = LookUpSymbol(ppToken->atom)) ? !s->mac.undef : 0; res = s ? ! s->mac.undef : 0;
token = scanToken(ppToken); token = scanToken(ppToken);
if (needclose) { if (needclose) {
if (token != ')') { if (token != ')') {
...@@ -690,8 +690,6 @@ int TPpContext::CPPerror(TPpToken* ppToken) ...@@ -690,8 +690,6 @@ int TPpContext::CPPerror(TPpToken* ppToken)
int TPpContext::CPPpragma(TPpToken* ppToken) int TPpContext::CPPpragma(TPpToken* ppToken)
{ {
char SrcStrName[2]; char SrcStrName[2];
int tokenCount = 0;
int maxTokenCount = 10;
const char* SrcStr; const char* SrcStr;
TVector<TString> tokens; TVector<TString> tokens;
...@@ -711,7 +709,7 @@ int TPpContext::CPPpragma(TPpToken* ppToken) ...@@ -711,7 +709,7 @@ int TPpContext::CPPpragma(TPpToken* ppToken)
tokens.push_back(SrcStr); tokens.push_back(SrcStr);
break; break;
default: default:
SrcStrName[0] = token; SrcStrName[0] = (char)token;
SrcStrName[1] = '\0'; SrcStrName[1] = '\0';
tokens.push_back(SrcStrName); tokens.push_back(SrcStrName);
} }
...@@ -887,7 +885,7 @@ TPpContext::TokenStream* TPpContext::PrescanMacroArg(TokenStream* a, TPpToken* p ...@@ -887,7 +885,7 @@ TPpContext::TokenStream* TPpContext::PrescanMacroArg(TokenStream* a, TPpToken* p
n = new TokenStream; n = new TokenStream;
pushInput(new tMarkerInput(this)); pushInput(new tMarkerInput(this));
pushTokenStreamInput(a, 0); pushTokenStreamInput(a);
while ((token = scanToken(ppToken)) != tMarkerInput::marker) { while ((token = scanToken(ppToken)) != tMarkerInput::marker) {
if (token == CPP_IDENTIFIER && MacroExpand(ppToken->atom, ppToken, false, newLineOkay) != 0) if (token == CPP_IDENTIFIER && MacroExpand(ppToken->atom, ppToken, false, newLineOkay) != 0)
continue; continue;
...@@ -916,7 +914,7 @@ int TPpContext::tMacroInput::scan(TPpToken* ppToken) ...@@ -916,7 +914,7 @@ int TPpContext::tMacroInput::scan(TPpToken* ppToken)
if (mac->args[i] == ppToken->atom) if (mac->args[i] == ppToken->atom)
break; break;
if (i >= 0) { if (i >= 0) {
pp->pushTokenStreamInput(args[i], ppToken->atom); pp->pushTokenStreamInput(args[i]);
return pp->scanToken(ppToken); return pp->scanToken(ppToken);
} }
......
...@@ -87,7 +87,7 @@ TPpContext::TPpContext(TParseContext& pc) : ...@@ -87,7 +87,7 @@ TPpContext::TPpContext(TParseContext& pc) :
preamble(0), strings(0), parseContext(pc), inComment(false) preamble(0), strings(0), parseContext(pc), inComment(false)
{ {
InitAtomTable(); InitAtomTable();
InitScanner(this); InitScanner();
ifdepth = 0; ifdepth = 0;
for (elsetracker = 0; elsetracker < maxIfNesting; elsetracker++) for (elsetracker = 0; elsetracker < maxIfNesting; elsetracker++)
......
...@@ -193,6 +193,9 @@ public: ...@@ -193,6 +193,9 @@ public:
TSymbolMap symbols; // this has light use... just defined macros TSymbolMap symbols; // this has light use... just defined macros
protected: protected:
TPpContext(TPpContext&);
TPpContext& operator=(TPpContext&);
char* preamble; // string to parse, all before line 1 of string 0, it is 0 if no preamble char* preamble; // string to parse, all before line 1 of string 0, it is 0 if no preamble
int preambleLength; int preambleLength;
char** strings; // official strings of shader, starting a string 0 line 1 char** strings; // official strings of shader, starting a string 0 line 1
...@@ -342,7 +345,7 @@ protected: ...@@ -342,7 +345,7 @@ protected:
void RecordToken(TokenStream* pTok, int token, TPpToken* ppToken); void RecordToken(TokenStream* pTok, int token, TPpToken* ppToken);
void RewindTokenStream(TokenStream *pTok); void RewindTokenStream(TokenStream *pTok);
int ReadToken(TokenStream* pTok, TPpToken* ppToken); int ReadToken(TokenStream* pTok, TPpToken* ppToken);
void pushTokenStreamInput(TokenStream *ts, int name); void pushTokenStreamInput(TokenStream *ts);
void UngetToken(int token, TPpToken* ppToken); void UngetToken(int token, TPpToken* ppToken);
class tTokenInput : public tInput { class tTokenInput : public tInput {
...@@ -445,7 +448,7 @@ protected: ...@@ -445,7 +448,7 @@ protected:
TInputScanner* input; TInputScanner* input;
}; };
int InitScanner(TPpContext* cpp); int InitScanner();
int ScanFromString(char* s); int ScanFromString(char* s);
void missingEndifCheck(); void missingEndifCheck();
int lFloatConst(int len, int ch, TPpToken* ppToken); int lFloatConst(int len, int ch, TPpToken* ppToken);
......
...@@ -95,8 +95,6 @@ struct chunk { ...@@ -95,8 +95,6 @@ struct chunk {
TPpContext::MemoryPool* TPpContext::mem_CreatePool(size_t chunksize, unsigned int align) TPpContext::MemoryPool* TPpContext::mem_CreatePool(size_t chunksize, unsigned int align)
{ {
MemoryPool *pool;
if (align == 0) if (align == 0)
align = ALIGN; align = ALIGN;
if (chunksize == 0) if (chunksize == 0)
...@@ -107,7 +105,9 @@ TPpContext::MemoryPool* TPpContext::mem_CreatePool(size_t chunksize, unsigned in ...@@ -107,7 +105,9 @@ TPpContext::MemoryPool* TPpContext::mem_CreatePool(size_t chunksize, unsigned in
return 0; return 0;
if (chunksize & (align - 1)) if (chunksize & (align - 1))
return 0; return 0;
if (!(pool = (MemoryPool*)malloc(chunksize)))
MemoryPool *pool = (MemoryPool*)malloc(chunksize);
if (! pool)
return 0; return 0;
pool->next = 0; pool->next = 0;
......
...@@ -92,7 +92,7 @@ NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ...@@ -92,7 +92,7 @@ NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace glslang { namespace glslang {
int TPpContext::InitScanner(TPpContext *cpp) int TPpContext::InitScanner()
{ {
// Add various atoms needed by the CPP line scanner: // Add various atoms needed by the CPP line scanner:
if (!InitCPP()) if (!InitCPP())
...@@ -127,13 +127,13 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken) ...@@ -127,13 +127,13 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
char* str = ppToken->name; char* str = ppToken->name;
if (ch == '.') { if (ch == '.') {
HasDecimalOrExponent = true; HasDecimalOrExponent = true;
str[len++]=ch; str[len++] = (char)ch;
ch = getChar(); ch = getChar();
while (ch >= '0' && ch <= '9') { while (ch >= '0' && ch <= '9') {
if (len < TPpToken::maxTokenLength) { if (len < TPpToken::maxTokenLength) {
declen++; declen++;
if (len > 0 || ch != '0') { if (len > 0 || ch != '0') {
str[len] = ch; str[len] = (char)ch;
len++; len++;
str_len++; str_len++;
} }
...@@ -155,21 +155,21 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken) ...@@ -155,21 +155,21 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
len = 1,str_len=1; len = 1,str_len=1;
} else { } else {
ExpSign = 1; ExpSign = 1;
str[len++]=ch; str[len++] = (char)ch;
ch = getChar(); ch = getChar();
if (ch == '+') { if (ch == '+') {
str[len++]=ch; str[len++] = (char)ch;
ch = getChar(); ch = getChar();
} else if (ch == '-') { } else if (ch == '-') {
ExpSign = -1; ExpSign = -1;
str[len++]=ch; str[len++] = (char)ch;
ch = getChar(); ch = getChar();
} }
if (ch >= '0' && ch <= '9') { if (ch >= '0' && ch <= '9') {
while (ch >= '0' && ch <= '9') { while (ch >= '0' && ch <= '9') {
if (len < TPpToken::maxTokenLength) { if (len < TPpToken::maxTokenLength) {
exp = exp*10 + ch - '0'; exp = exp*10 + ch - '0';
str[len++]=ch; str[len++] = (char)ch;
ch = getChar(); ch = getChar();
} else { } else {
parseContext.error(ppToken->loc, "float literal too long", "", ""); parseContext.error(ppToken->loc, "float literal too long", "", "");
...@@ -197,8 +197,8 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken) ...@@ -197,8 +197,8 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
ungetChar(); ungetChar();
} else { } else {
if (len < TPpToken::maxTokenLength) { if (len < TPpToken::maxTokenLength) {
str[len++] = ch; str[len++] = (char)ch;
str[len++] = ch2; str[len++] = (char)ch2;
isDouble = 1; isDouble = 1;
} else { } else {
parseContext.error(ppToken->loc, "float literal too long", "", ""); parseContext.error(ppToken->loc, "float literal too long", "", "");
...@@ -212,7 +212,7 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken) ...@@ -212,7 +212,7 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
if (! HasDecimalOrExponent) if (! HasDecimalOrExponent)
parseContext.error(ppToken->loc, "float literal needs a decimal point or exponent", "", ""); parseContext.error(ppToken->loc, "float literal needs a decimal point or exponent", "", "");
if (len < TPpToken::maxTokenLength) if (len < TPpToken::maxTokenLength)
str[len++] = ch; str[len++] = (char)ch;
else { else {
parseContext.error(ppToken->loc, "float literal too long", "", ""); parseContext.error(ppToken->loc, "float literal too long", "", "");
len = 1,str_len=1; len = 1,str_len=1;
...@@ -238,7 +238,9 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) ...@@ -238,7 +238,9 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
{ {
char tokenText[TPpToken::maxTokenLength + 1]; char tokenText[TPpToken::maxTokenLength + 1];
int AlreadyComplained = 0; int AlreadyComplained = 0;
int len, ch, ii; int len = 0;
int ch = 0;
int ii = 0;
unsigned ival = 0; unsigned ival = 0;
ppToken->ival = 0; ppToken->ival = 0;
...@@ -273,7 +275,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) ...@@ -273,7 +275,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
case 'z': case 'z':
do { do {
if (len < TPpToken::maxTokenLength) { if (len < TPpToken::maxTokenLength) {
tokenText[len++] = ch; tokenText[len++] = (char)ch;
ch = pp->getChar(); ch = pp->getChar();
} else { } else {
if (! AlreadyComplained) { if (! AlreadyComplained) {
...@@ -297,13 +299,13 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) ...@@ -297,13 +299,13 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
return CPP_IDENTIFIER; return CPP_IDENTIFIER;
case '0': case '0':
ppToken->name[len++] = ch; ppToken->name[len++] = (char)ch;
ch = pp->getChar(); ch = pp->getChar();
if (ch == 'x' || ch == 'X') { if (ch == 'x' || ch == 'X') {
// must be hexidecimal // must be hexidecimal
bool isUnsigned = false; bool isUnsigned = false;
ppToken->name[len++] = ch; ppToken->name[len++] = (char)ch;
ch = pp->getChar(); ch = pp->getChar();
if ((ch >= '0' && ch <= '9') || if ((ch >= '0' && ch <= '9') ||
(ch >= 'A' && ch <= 'F') || (ch >= 'A' && ch <= 'F') ||
...@@ -312,7 +314,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) ...@@ -312,7 +314,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
ival = 0; ival = 0;
do { do {
if (ival <= 0x0fffffff) { if (ival <= 0x0fffffff) {
ppToken->name[len++] = ch; ppToken->name[len++] = (char)ch;
if (ch >= '0' && ch <= '9') { if (ch >= '0' && ch <= '9') {
ii = ch - '0'; ii = ch - '0';
} else if (ch >= 'A' && ch <= 'F') { } else if (ch >= 'A' && ch <= 'F') {
...@@ -338,7 +340,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) ...@@ -338,7 +340,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
} }
if (ch == 'u' || ch == 'U') { if (ch == 'u' || ch == 'U') {
if (len < TPpToken::maxTokenLength) if (len < TPpToken::maxTokenLength)
ppToken->name[len++] = ch; ppToken->name[len++] = (char)ch;
isUnsigned = true; isUnsigned = true;
} else } else
pp->ungetChar(); pp->ungetChar();
...@@ -360,7 +362,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) ...@@ -360,7 +362,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
// see how much octal-like stuff we can read // see how much octal-like stuff we can read
while (ch >= '0' && ch <= '7') { while (ch >= '0' && ch <= '7') {
if (len < TPpToken::maxTokenLength) if (len < TPpToken::maxTokenLength)
ppToken->name[len++] = ch; ppToken->name[len++] = (char)ch;
else if (! AlreadyComplained) { else if (! AlreadyComplained) {
pp->parseContext.error(ppToken->loc, "numeric literal too long", "", ""); pp->parseContext.error(ppToken->loc, "numeric literal too long", "", "");
AlreadyComplained = 1; AlreadyComplained = 1;
...@@ -378,7 +380,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) ...@@ -378,7 +380,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
nonOctal = true; nonOctal = true;
do { do {
if (len < TPpToken::maxTokenLength) if (len < TPpToken::maxTokenLength)
ppToken->name[len++] = ch; ppToken->name[len++] = (char)ch;
else if (! AlreadyComplained) { else if (! AlreadyComplained) {
pp->parseContext.error(ppToken->loc, "numeric literal too long", "", ""); pp->parseContext.error(ppToken->loc, "numeric literal too long", "", "");
AlreadyComplained = 1; AlreadyComplained = 1;
...@@ -395,7 +397,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) ...@@ -395,7 +397,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
if (ch == 'u' || ch == 'U') { if (ch == 'u' || ch == 'U') {
if (len < TPpToken::maxTokenLength) if (len < TPpToken::maxTokenLength)
ppToken->name[len++] = ch; ppToken->name[len++] = (char)ch;
isUnsigned = true; isUnsigned = true;
} else } else
pp->ungetChar(); pp->ungetChar();
...@@ -418,7 +420,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) ...@@ -418,7 +420,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
do { do {
if (len < TPpToken::maxTokenLength) if (len < TPpToken::maxTokenLength)
ppToken->name[len++] = ch; ppToken->name[len++] = (char)ch;
else if (! AlreadyComplained) { else if (! AlreadyComplained) {
pp->parseContext.error(ppToken->loc, "numeric literal too long", "", ""); pp->parseContext.error(ppToken->loc, "numeric literal too long", "", "");
AlreadyComplained = 1; AlreadyComplained = 1;
...@@ -433,7 +435,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) ...@@ -433,7 +435,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
int uint = 0; int uint = 0;
if (ch == 'u' || ch == 'U') { if (ch == 'u' || ch == 'U') {
if (len < TPpToken::maxTokenLength) if (len < TPpToken::maxTokenLength)
ppToken->name[len++] = ch; ppToken->name[len++] = (char)ch;
uint = 1; uint = 1;
} else } else
pp->ungetChar(); pp->ungetChar();
...@@ -442,9 +444,9 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) ...@@ -442,9 +444,9 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
ival = 0; ival = 0;
for (ii = 0; ii < numericLen; ii++) { for (ii = 0; ii < numericLen; ii++) {
ch = ppToken->name[ii] - '0'; ch = ppToken->name[ii] - '0';
if ((ival > 429496729) || (ival == 429496729 && ch >= 6)) { if ((ival > 0x19999999u) || (ival == 0x19999999u && ch >= 6)) {
pp->parseContext.error(ppToken->loc, "numeric literal too big", "", ""); pp->parseContext.error(ppToken->loc, "numeric literal too big", "", "");
ival = -1; ival = 0xFFFFFFFFu;
break; break;
} else } else
ival = ival * 10 + ch; ival = ival * 10 + ch;
...@@ -651,7 +653,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) ...@@ -651,7 +653,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
ch = pp->getChar(); ch = pp->getChar();
while (ch != '"' && ch != '\n' && ch != EOF) { while (ch != '"' && ch != '\n' && ch != EOF) {
if (len < TPpToken::maxTokenLength) { if (len < TPpToken::maxTokenLength) {
tokenText[len] = ch; tokenText[len] = (char)ch;
len++; len++;
ch = pp->getChar(); ch = pp->getChar();
} else } else
......
...@@ -197,7 +197,7 @@ int TPpContext::ReadToken(TokenStream *pTok, TPpToken *ppToken) ...@@ -197,7 +197,7 @@ int TPpContext::ReadToken(TokenStream *pTok, TPpToken *ppToken)
ch = lReadByte(pTok); ch = lReadByte(pTok);
while (ch != 0) { while (ch != 0) {
if (len < TPpToken::maxTokenLength) { if (len < TPpToken::maxTokenLength) {
tokenText[len] = ch; tokenText[len] = (char)ch;
len++; len++;
ch = lReadByte(pTok); ch = lReadByte(pTok);
} else { } else {
...@@ -239,7 +239,7 @@ int TPpContext::tTokenInput::scan(TPpToken* ppToken) ...@@ -239,7 +239,7 @@ int TPpContext::tTokenInput::scan(TPpToken* ppToken)
return pp->ReadToken(tokens, ppToken); return pp->ReadToken(tokens, ppToken);
} }
void TPpContext::pushTokenStreamInput(TokenStream* ts, int name) void TPpContext::pushTokenStreamInput(TokenStream* ts)
{ {
pushInput(new tTokenInput(this, ts)); pushInput(new tTokenInput(this, ts));
RewindTokenStream(ts); RewindTokenStream(ts);
......
...@@ -618,6 +618,10 @@ public: ...@@ -618,6 +618,10 @@ public:
const TIntermediate& intermediate; const TIntermediate& intermediate;
TReflection& reflection; TReflection& reflection;
std::set<const TIntermNode*> processedDerefs; std::set<const TIntermNode*> processedDerefs;
protected:
TLiveTraverser(TLiveTraverser&);
TLiveTraverser& operator=(TLiveTraverser&);
}; };
// //
......
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