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

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@31202 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2015-05-15 17:30:55 +00:00
parent 2aa7f3a671
commit 93dfbe1309
35 changed files with 178 additions and 168 deletions

View File

@ -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,12 +1029,9 @@ 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();
result = createMiscOperation(node->getOp(), precision, convertGlslangToSpvType(node->getType()), operands, type.getBasicType() == glslang::EbtUint);
break; break;
} }
}
if (noReturnValue) if (noReturnValue)
return false; return false;
@ -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:
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
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
} 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());

View File

@ -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");
} }

View File

@ -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)
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)
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)
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)
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)
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)
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)
} }
// 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)
} }
// 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
// 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)
// 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
} }
// 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)
} }
// 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()
// 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();

View File

@ -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:
// 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:
void makeEndIf(); void makeEndIf();
private: private:
If(const If&);
If& operator=(If&);
Builder& builder; Builder& builder;
Id condition; Id condition;
Function* function; Function* function;

View File

@ -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()
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

View File

@ -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:
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:
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;

View File

@ -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;
} }

View File

@ -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;

View File

@ -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:
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)

View File

@ -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:
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

View File

@ -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:
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;
}; };

View File

@ -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:
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

View File

@ -696,13 +696,13 @@ public:
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:
const bool rightToLeft; const bool rightToLeft;
protected: protected:
TIntermTraverser& operator=(TIntermTraverser&);
int depth; int depth;
int maxDepth; int maxDepth;

View File

@ -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);

View File

@ -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

View File

@ -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.
} }

View File

@ -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
// 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

View File

@ -536,7 +536,7 @@ void TParseContext::checkIndex(TSourceLoc loc, const TType& type, int& index)
} }
// for ES 2.0 (version 100) limitations for almost all index operations except vertex-shader uniforms // for ES 2.0 (version 100) limitations for almost all index operations except vertex-shader uniforms
void TParseContext::handleIndexLimits(TSourceLoc loc, TIntermTyped* base, TIntermTyped* index) void TParseContext::handleIndexLimits(TSourceLoc /*loc*/, TIntermTyped* base, TIntermTyped* index)
{ {
if ((! limits.generalSamplerIndexing && base->getBasicType() == EbtSampler) || if ((! limits.generalSamplerIndexing && base->getBasicType() == EbtSampler) ||
(! limits.generalUniformIndexing && base->getQualifier().isUniformOrBuffer() && language != EShLangVertex) || (! limits.generalUniformIndexing && base->getQualifier().isUniformOrBuffer() && language != EShLangVertex) ||
@ -611,7 +611,7 @@ void TParseContext::ioArrayCheck(TSourceLoc loc, const TType& type, const TStrin
// Handle a dereference of a geometry shader input array or tessellation control output array. // Handle a dereference of a geometry shader input array or tessellation control output array.
// See ioArraySymbolResizeList comment in ParseHelper.h. // See ioArraySymbolResizeList comment in ParseHelper.h.
// //
void TParseContext::handleIoResizeArrayAccess(TSourceLoc loc, TIntermTyped* base) void TParseContext::handleIoResizeArrayAccess(TSourceLoc /*loc*/, TIntermTyped* base)
{ {
TIntermSymbol* symbolNode = base->getAsSymbolNode(); TIntermSymbol* symbolNode = base->getAsSymbolNode();
assert(symbolNode); assert(symbolNode);
@ -645,6 +645,8 @@ void TParseContext::checkIoArraysConsistency(TSourceLoc loc, bool tailOnly)
feature = TQualifier::getGeometryString(intermediate.getInputPrimitive()); feature = TQualifier::getGeometryString(intermediate.getInputPrimitive());
else if (language == EShLangTessControl) else if (language == EShLangTessControl)
feature = "vertices"; feature = "vertices";
else
feature = "unknown";
if (tailOnly) { if (tailOnly) {
checkIoArrayConsistency(loc, requiredSize, feature, ioArraySymbolResizeList.back()->getWritableType(), ioArraySymbolResizeList.back()->getName()); checkIoArrayConsistency(loc, requiredSize, feature, ioArraySymbolResizeList.back()->getWritableType(), ioArraySymbolResizeList.back()->getName());
@ -1408,7 +1410,7 @@ TOperator TParseContext::mapTypeToConstructorOp(const TType& type) const
if (type.isStruct()) if (type.isStruct())
return EOpConstructStruct; return EOpConstructStruct;
TOperator op; TOperator op = EOpNull;
switch (type.getBasicType()) { switch (type.getBasicType()) {
case EbtFloat: case EbtFloat:
if (type.isMatrix()) { if (type.isMatrix()) {
@ -1515,7 +1517,6 @@ TOperator TParseContext::mapTypeToConstructorOp(const TType& type) const
} }
break; break;
default: default:
op = EOpNull;
break; break;
} }
@ -1930,7 +1931,7 @@ bool TParseContext::constructorError(TSourceLoc loc, TIntermNode* node, TFunctio
return true; return true;
} }
if (op == EOpConstructStruct && ! type.isArray() && type.getStruct()->size() != function.getParamCount()) { if (op == EOpConstructStruct && ! type.isArray() && (int)type.getStruct()->size() != function.getParamCount()) {
error(loc, "Number of constructor parameters does not match the number of structure fields", "constructor", ""); error(loc, "Number of constructor parameters does not match the number of structure fields", "constructor", "");
return true; return true;
} }
@ -2228,7 +2229,7 @@ void TParseContext::mergeQualifiers(TSourceLoc loc, TQualifier& dst, const TQual
dst.precision = src.precision; dst.precision = src.precision;
// Layout qualifiers // Layout qualifiers
mergeObjectLayoutQualifiers(loc, dst, src, false); mergeObjectLayoutQualifiers(dst, src, false);
// individual qualifiers // individual qualifiers
bool repeated = false; bool repeated = false;
@ -2422,7 +2423,7 @@ void TParseContext::arraySizeRequiredCheck(TSourceLoc loc, int size)
} }
} }
void TParseContext::structArrayCheck(TSourceLoc loc, TType* type) void TParseContext::structArrayCheck(TSourceLoc /*loc*/, TType* type)
{ {
const TTypeList& structure = *type->getStruct(); const TTypeList& structure = *type->getStruct();
for (int m = 0; m < (int)structure.size(); ++m) { for (int m = 0; m < (int)structure.size(); ++m) {
@ -2545,7 +2546,7 @@ void TParseContext::updateImplicitArraySize(TSourceLoc loc, TIntermNode *node, i
// as that type will be shared through shallow copies for future references. // as that type will be shared through shallow copies for future references.
TSymbol* symbol = 0; TSymbol* symbol = 0;
int blockIndex = -1; int blockIndex = -1;
const TString* lookupName; const TString* lookupName = 0;
if (node->getAsSymbolNode()) if (node->getAsSymbolNode())
lookupName = &node->getAsSymbolNode()->getName(); lookupName = &node->getAsSymbolNode()->getName();
else if (node->getAsBinaryNode()) { else if (node->getAsBinaryNode()) {
@ -2782,7 +2783,7 @@ void TParseContext::redeclareBuiltinBlock(TSourceLoc loc, TTypeList& newTypeList
// look for match // look for match
bool found = false; bool found = false;
TTypeList::const_iterator newMember; TTypeList::const_iterator newMember;
TSourceLoc memberLoc; TSourceLoc memberLoc = {};
for (newMember = newTypeList.begin(); newMember != newTypeList.end(); ++newMember) { for (newMember = newTypeList.begin(); newMember != newTypeList.end(); ++newMember) {
if (member->type->getFieldName() == newMember->type->getFieldName()) { if (member->type->getFieldName() == newMember->type->getFieldName()) {
found = true; found = true;
@ -2935,7 +2936,7 @@ void TParseContext::opaqueCheck(TSourceLoc loc, const TType& type, const char* o
error(loc, "can't use with samplers or structs containing samplers", op, ""); error(loc, "can't use with samplers or structs containing samplers", op, "");
} }
void TParseContext::structTypeCheck(TSourceLoc loc, TPublicType& publicType) void TParseContext::structTypeCheck(TSourceLoc /*loc*/, TPublicType& publicType)
{ {
const TTypeList& typeList = *publicType.userDef->getStruct(); const TTypeList& typeList = *publicType.userDef->getStruct();
@ -2982,7 +2983,7 @@ void TParseContext::inductiveLoopCheck(TSourceLoc loc, TIntermNode* init, TInter
bool badInit = false; bool badInit = false;
if (! init || ! init->getAsAggregate() || init->getAsAggregate()->getSequence().size() != 1) if (! init || ! init->getAsAggregate() || init->getAsAggregate()->getSequence().size() != 1)
badInit = true; badInit = true;
TIntermBinary* binaryInit; TIntermBinary* binaryInit = 0;
if (! badInit) { if (! badInit) {
// get the declaration assignment // get the declaration assignment
binaryInit = init->getAsAggregate()->getSequence()[0]->getAsBinaryNode(); binaryInit = init->getAsAggregate()->getSequence()[0]->getAsBinaryNode();
@ -3457,7 +3458,7 @@ void TParseContext::setLayoutQualifier(TSourceLoc loc, TPublicType& publicType,
// overrides the other (e.g., row_major vs. column_major); only the last // overrides the other (e.g., row_major vs. column_major); only the last
// occurrence has any effect." // occurrence has any effect."
// //
void TParseContext::mergeObjectLayoutQualifiers(TSourceLoc loc, TQualifier& dst, const TQualifier& src, bool inheritOnly) void TParseContext::mergeObjectLayoutQualifiers(TQualifier& dst, const TQualifier& src, bool inheritOnly)
{ {
if (src.hasMatrix()) if (src.hasMatrix())
dst.layoutMatrix = src.layoutMatrix; dst.layoutMatrix = src.layoutMatrix;
@ -3853,8 +3854,6 @@ const TFunction* TParseContext::findFunction(TSourceLoc loc, const TFunction& ca
// Function finding algorithm for ES and desktop 110. // Function finding algorithm for ES and desktop 110.
const TFunction* TParseContext::findFunctionExact(TSourceLoc loc, const TFunction& call, bool& builtIn) const TFunction* TParseContext::findFunctionExact(TSourceLoc loc, const TFunction& call, bool& builtIn)
{ {
const TFunction* function = 0;
TSymbol* symbol = symbolTable.find(call.getMangledName(), &builtIn); TSymbol* symbol = symbolTable.find(call.getMangledName(), &builtIn);
if (symbol == 0) { if (symbol == 0) {
error(loc, "no matching overloaded function found", call.getName().c_str(), ""); error(loc, "no matching overloaded function found", call.getName().c_str(), "");
@ -3886,7 +3885,6 @@ const TFunction* TParseContext::findFunction120(TSourceLoc loc, const TFunction&
TVector<TFunction*> candidateList; TVector<TFunction*> candidateList;
symbolTable.findFunctionNameList(call.getMangledName(), candidateList, builtIn); symbolTable.findFunctionNameList(call.getMangledName(), candidateList, builtIn);
int numPossibleMatches = 0;
for (TVector<TFunction*>::const_iterator it = candidateList.begin(); it != candidateList.end(); ++it) { for (TVector<TFunction*>::const_iterator it = candidateList.begin(); it != candidateList.end(); ++it) {
const TFunction& function = *(*it); const TFunction& function = *(*it);
@ -4034,7 +4032,7 @@ TIntermNode* TParseContext::declareVariable(TSourceLoc loc, TString& identifier,
error(loc, "initializer requires a variable, not a member", identifier.c_str(), ""); error(loc, "initializer requires a variable, not a member", identifier.c_str(), "");
return 0; return 0;
} }
initNode = executeInitializer(loc, identifier, initializer, variable); initNode = executeInitializer(loc, initializer, variable);
} }
// look for errors in layout qualifier use // look for errors in layout qualifier use
@ -4068,7 +4066,6 @@ void TParseContext::inheritGlobalDefaults(TQualifier& dst) const
TVariable* TParseContext::makeInternalVariable(const char* name, const TType& type) const TVariable* TParseContext::makeInternalVariable(const char* name, const TType& type) const
{ {
TString* nameString = new TString(name); TString* nameString = new TString(name);
TSourceLoc loc = {0, 0};
TVariable* variable = new TVariable(nameString, type); TVariable* variable = new TVariable(nameString, type);
symbolTable.makeInternalVariable(*variable); symbolTable.makeInternalVariable(*variable);
@ -4103,8 +4100,7 @@ TVariable* TParseContext::declareNonArray(TSourceLoc loc, TString& identifier, T
// Returning 0 just means there is no code to execute to handle the // Returning 0 just means there is no code to execute to handle the
// initializer, which will, for example, be the case for constant initializers. // initializer, which will, for example, be the case for constant initializers.
// //
TIntermNode* TParseContext::executeInitializer(TSourceLoc loc, TString& identifier, TIntermNode* TParseContext::executeInitializer(TSourceLoc loc, TIntermTyped* initializer, TVariable* variable)
TIntermTyped* initializer, TVariable* variable)
{ {
// //
// Identifier must be of type constant, a global, or a temporary, and // Identifier must be of type constant, a global, or a temporary, and
@ -4241,7 +4237,7 @@ TIntermTyped* TParseContext::convertInitializerList(TSourceLoc loc, const TType&
return 0; return 0;
} }
} else if (type.isMatrix()) { } else if (type.isMatrix()) {
if (type.getMatrixCols() != initList->getSequence().size()) { if (type.getMatrixCols() != (int)initList->getSequence().size()) {
error(loc, "wrong number of matrix columns:", "initializer list", type.getCompleteString().c_str()); error(loc, "wrong number of matrix columns:", "initializer list", type.getCompleteString().c_str());
return 0; return 0;
} }
@ -4252,7 +4248,7 @@ TIntermTyped* TParseContext::convertInitializerList(TSourceLoc loc, const TType&
return 0; return 0;
} }
} else if (type.isVector()) { } else if (type.isVector()) {
if (type.getVectorSize() != initList->getSequence().size()) { if (type.getVectorSize() != (int)initList->getSequence().size()) {
error(loc, "wrong vector size (or rows in a matrix column):", "initializer list", type.getCompleteString().c_str()); error(loc, "wrong vector size (or rows in a matrix column):", "initializer list", type.getCompleteString().c_str());
return 0; return 0;
} }
@ -4546,7 +4542,7 @@ void TParseContext::declareBlock(TSourceLoc loc, TTypeList& typeList, const TStr
// fix and check for member layout qualifiers // fix and check for member layout qualifiers
mergeObjectLayoutQualifiers(loc, defaultQualification, currentBlockQualifier, true); mergeObjectLayoutQualifiers(defaultQualification, currentBlockQualifier, true);
// "The offset qualifier can only be used on block members of blocks declared with std140 or std430 layouts." // "The offset qualifier can only be used on block members of blocks declared with std140 or std430 layouts."
// "The align qualifier can only be used on blocks or block members, and only for blocks declared with std140 or std430 layouts." // "The align qualifier can only be used on blocks or block members, and only for blocks declared with std140 or std430 layouts."
@ -4605,14 +4601,14 @@ void TParseContext::declareBlock(TSourceLoc loc, TTypeList& typeList, const TStr
// Process the members // Process the members
fixBlockLocations(loc, currentBlockQualifier, typeList, memberWithLocation, memberWithoutLocation); fixBlockLocations(loc, currentBlockQualifier, typeList, memberWithLocation, memberWithoutLocation);
fixBlockXfbOffsets(loc, currentBlockQualifier, typeList); fixBlockXfbOffsets(currentBlockQualifier, typeList);
fixBlockUniformOffsets(loc, currentBlockQualifier, typeList); fixBlockUniformOffsets(currentBlockQualifier, typeList);
for (unsigned int member = 0; member < typeList.size(); ++member) for (unsigned int member = 0; member < typeList.size(); ++member)
layoutTypeCheck(typeList[member].loc, *typeList[member].type); layoutTypeCheck(typeList[member].loc, *typeList[member].type);
// reverse merge, so that currentBlockQualifier now has all layout information // reverse merge, so that currentBlockQualifier now has all layout information
// (can't use defaultQualification directly, it's missing other non-layout-default-class qualifiers) // (can't use defaultQualification directly, it's missing other non-layout-default-class qualifiers)
mergeObjectLayoutQualifiers(loc, currentBlockQualifier, defaultQualification, true); mergeObjectLayoutQualifiers(currentBlockQualifier, defaultQualification, true);
// //
// Build and add the interface block as a new type named 'blockName' // Build and add the interface block as a new type named 'blockName'
@ -4696,7 +4692,7 @@ void TParseContext::fixBlockLocations(TSourceLoc loc, TQualifier& qualifier, TTy
else { else {
if (memberWithLocation) { if (memberWithLocation) {
// remove any block-level location and make it per *every* member // remove any block-level location and make it per *every* member
int nextLocation; // by the rule above, initial value is not relevant int nextLocation = 0; // by the rule above, initial value is not relevant
if (qualifier.hasAnyLocation()) { if (qualifier.hasAnyLocation()) {
nextLocation = qualifier.layoutLocation; nextLocation = qualifier.layoutLocation;
qualifier.layoutLocation = TQualifier::layoutLocationEnd; qualifier.layoutLocation = TQualifier::layoutLocationEnd;
@ -4723,7 +4719,7 @@ void TParseContext::fixBlockLocations(TSourceLoc loc, TQualifier& qualifier, TTy
} }
} }
void TParseContext::fixBlockXfbOffsets(TSourceLoc loc, TQualifier& qualifier, TTypeList& typeList) void TParseContext::fixBlockXfbOffsets(TQualifier& qualifier, TTypeList& typeList)
{ {
// "If a block is qualified with xfb_offset, all its // "If a block is qualified with xfb_offset, all its
// members are assigned transform feedback buffer offsets. If a block is not qualified with xfb_offset, any // members are assigned transform feedback buffer offsets. If a block is not qualified with xfb_offset, any
@ -4760,7 +4756,7 @@ void TParseContext::fixBlockXfbOffsets(TSourceLoc loc, TQualifier& qualifier, TT
// Also, compute and save the total size of the block. For the block's size, arrayness // Also, compute and save the total size of the block. For the block's size, arrayness
// is not taken into account, as each element is backed by a separate buffer. // is not taken into account, as each element is backed by a separate buffer.
// //
void TParseContext::fixBlockUniformOffsets(TSourceLoc loc, TQualifier& qualifier, TTypeList& typeList) void TParseContext::fixBlockUniformOffsets(TQualifier& qualifier, TTypeList& typeList)
{ {
if (! qualifier.isUniformOrBuffer()) if (! qualifier.isUniformOrBuffer())
return; return;
@ -4950,7 +4946,7 @@ void TParseContext::updateStandaloneQualifierDefaults(TSourceLoc loc, const TPub
if (! intermediate.setLocalSize(i, publicType.shaderQualifiers.localSize[i])) if (! intermediate.setLocalSize(i, publicType.shaderQualifiers.localSize[i]))
error(loc, "cannot change previously set size", "local_size", ""); error(loc, "cannot change previously set size", "local_size", "");
else { else {
int max; int max = 0;
switch (i) { switch (i) {
case 0: max = resources.maxComputeWorkGroupSizeX; break; case 0: max = resources.maxComputeWorkGroupSizeX; break;
case 1: max = resources.maxComputeWorkGroupSizeY; break; case 1: max = resources.maxComputeWorkGroupSizeY; break;

View File

@ -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:
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:
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:
TLimits& limits; TLimits& limits;
protected: protected:
TParseContext(TParseContext&);
TParseContext& operator=(TParseContext&);
TScanContext* scanContext; TScanContext* scanContext;
TPpContext* ppContext; TPpContext* ppContext;
TInputScanner* currentScanner; TInputScanner* currentScanner;

View File

@ -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++) {

View File

@ -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:
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)
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;

View File

@ -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();

View File

@ -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(
// 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)
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()
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)

View File

@ -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

View File

@ -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&);
}; };
// //

View File

@ -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:
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

View File

@ -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;

View File

@ -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)

View File

@ -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)
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)
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
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)
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);
} }

View File

@ -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++)

View File

@ -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:
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:
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);

View File

@ -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
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;

View File

@ -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)
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)
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)
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)
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)
{ {
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)
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)
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)
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)
} }
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)
// 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)
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)
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)
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)
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)
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)
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

View File

@ -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)
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);

View File

@ -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&);
}; };
// //