Commit 75782629 by hendrikw Committed by Corentin Wallez

Fix possible compiler errors on linux

Change-Id: Ifc45446c749690eddc406f66f144304262f04664 Reviewed-on: https://chromium-review.googlesource.com/302478Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Tested-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent 928cccc6
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
// This file is automatically generated. // This file is automatically generated.
#include "common/mathutil.h"
namespace gl namespace gl
{ {
...@@ -2197,7 +2199,7 @@ const static unsigned g_offset[64] = { ...@@ -2197,7 +2199,7 @@ const static unsigned g_offset[64] = {
float float16ToFloat32(unsigned short h) float float16ToFloat32(unsigned short h)
{ {
unsigned i32 = g_mantissa[g_offset[h >> 10] + (h & 0x3ff)] + g_exponent[h >> 10]; unsigned i32 = g_mantissa[g_offset[h >> 10] + (h & 0x3ff)] + g_exponent[h >> 10];
return *(float*) &i32; return bitCast<float>(i32);
} }
} }
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
# point numbers to 32-bit. # point numbers to 32-bit.
# It is based on ftp://ftp.fox-toolkit.org/pub/fasthalffloatconversion.pdf. # It is based on ftp://ftp.fox-toolkit.org/pub/fasthalffloatconversion.pdf.
#include "common/mathutil.h"
def convertMantissa(i): def convertMantissa(i):
if i == 0: if i == 0:
return 0 return 0
...@@ -72,7 +74,7 @@ print "};\n" ...@@ -72,7 +74,7 @@ print "};\n"
print """float float16ToFloat32(unsigned short h) print """float float16ToFloat32(unsigned short h)
{ {
unsigned i32 = g_mantissa[g_offset[h >> 10] + (h & 0x3ff)] + g_exponent[h >> 10]; unsigned i32 = g_mantissa[g_offset[h >> 10] + (h & 0x3ff)] + g_exponent[h >> 10];
return *(float*) &i32; return bitCast<float>(i32);
} }
} }
""" """
...@@ -52,7 +52,7 @@ unsigned int convertRGBFloatsTo999E5(float red, float green, float blue) ...@@ -52,7 +52,7 @@ unsigned int convertRGBFloatsTo999E5(float red, float green, float blue)
output.B = static_cast<unsigned int>(floor((blue_c / (pow(2.0f, exp_s - g_sharedexp_bias - g_sharedexp_mantissabits))) + 0.5f)); output.B = static_cast<unsigned int>(floor((blue_c / (pow(2.0f, exp_s - g_sharedexp_bias - g_sharedexp_mantissabits))) + 0.5f));
output.E = exp_s; output.E = exp_s;
return *reinterpret_cast<unsigned int*>(&output); return bitCast<unsigned int>(output);
} }
void convert999E5toRGBFloats(unsigned int input, float *red, float *green, float *blue) void convert999E5toRGBFloats(unsigned int input, float *red, float *green, float *blue)
......
...@@ -151,7 +151,7 @@ destType bitCast(const sourceType &source) ...@@ -151,7 +151,7 @@ destType bitCast(const sourceType &source)
inline unsigned short float32ToFloat16(float fp32) inline unsigned short float32ToFloat16(float fp32)
{ {
unsigned int fp32i = (unsigned int&)fp32; unsigned int fp32i = bitCast<unsigned int>(fp32);
unsigned int sign = (fp32i & 0x80000000) >> 16; unsigned int sign = (fp32i & 0x80000000) >> 16;
unsigned int abs = fp32i & 0x7FFFFFFF; unsigned int abs = fp32i & 0x7FFFFFFF;
......
...@@ -223,9 +223,9 @@ bool TStructure::containsSamplers() const ...@@ -223,9 +223,9 @@ bool TStructure::containsSamplers() const
return false; return false;
} }
TString TFieldListCollection::buildMangledName() const TString TFieldListCollection::buildMangledName(const TString &mangledNamePrefix) const
{ {
TString mangledName(mangledNamePrefix()); TString mangledName(mangledNamePrefix);
mangledName += *mName; mangledName += *mName;
for (size_t i = 0; i < mFields->size(); ++i) for (size_t i = 0; i < mFields->size(); ++i)
{ {
......
...@@ -73,12 +73,6 @@ class TFieldListCollection : angle::NonCopyable ...@@ -73,12 +73,6 @@ class TFieldListCollection : angle::NonCopyable
return *mFields; return *mFields;
} }
const TString &mangledName() const
{
if (mMangledName.empty())
mMangledName = buildMangledName();
return mMangledName;
}
size_t objectSize() const size_t objectSize() const
{ {
if (mObjectSize == 0) if (mObjectSize == 0)
...@@ -93,9 +87,8 @@ class TFieldListCollection : angle::NonCopyable ...@@ -93,9 +87,8 @@ class TFieldListCollection : angle::NonCopyable
mObjectSize(0) mObjectSize(0)
{ {
} }
TString buildMangledName() const; TString buildMangledName(const TString &mangledNamePrefix) const;
size_t calculateObjectSize() const; size_t calculateObjectSize() const;
virtual TString mangledNamePrefix() const = 0;
const TString *mName; const TString *mName;
TFieldList *mFields; TFieldList *mFields;
...@@ -150,6 +143,13 @@ class TStructure : public TFieldListCollection ...@@ -150,6 +143,13 @@ class TStructure : public TFieldListCollection
return mAtGlobalScope; return mAtGlobalScope;
} }
const TString &mangledName() const
{
if (mMangledName.empty())
mMangledName = buildMangledName("struct-");
return mMangledName;
}
private: private:
// TODO(zmo): Find a way to get rid of the const_cast in function // TODO(zmo): Find a way to get rid of the const_cast in function
// setName(). At the moment keep this function private so only // setName(). At the moment keep this function private so only
...@@ -161,7 +161,6 @@ class TStructure : public TFieldListCollection ...@@ -161,7 +161,6 @@ class TStructure : public TFieldListCollection
*mutableName = name; *mutableName = name;
} }
TString mangledNamePrefix() const override { return "struct-"; }
int calculateDeepestNesting() const; int calculateDeepestNesting() const;
mutable int mDeepestNesting; mutable int mDeepestNesting;
...@@ -207,10 +206,14 @@ class TInterfaceBlock : public TFieldListCollection ...@@ -207,10 +206,14 @@ class TInterfaceBlock : public TFieldListCollection
{ {
return mMatrixPacking; return mMatrixPacking;
} }
const TString &mangledName() const
{
if (mMangledName.empty())
mMangledName = buildMangledName("iblock-");
return mMangledName;
}
private: private:
TString mangledNamePrefix() const override { return "iblock-"; }
const TString *mInstanceName; // for interface block instance names const TString *mInstanceName; // for interface block instance names
int mArraySize; // 0 if not an array int mArraySize; // 0 if not an array
TLayoutBlockStorage mBlockStorage; TLayoutBlockStorage mBlockStorage;
......
...@@ -50,6 +50,7 @@ class COMPILER_EXPORT BlockLayoutEncoder ...@@ -50,6 +50,7 @@ class COMPILER_EXPORT BlockLayoutEncoder
{ {
public: public:
BlockLayoutEncoder(); BlockLayoutEncoder();
virtual ~BlockLayoutEncoder() {}
BlockMemberInfo encodeType(GLenum type, unsigned int arraySize, bool isRowMajorMatrix); BlockMemberInfo encodeType(GLenum type, unsigned int arraySize, bool isRowMajorMatrix);
......
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
// found in the LICENSE file. // found in the LICENSE file.
// //
#pragma warning(disable: 4718)
#include "compiler/translator/depgraph/DependencyGraph.h" #include "compiler/translator/depgraph/DependencyGraph.h"
#include "compiler/translator/depgraph/DependencyGraphBuilder.h" #include "compiler/translator/depgraph/DependencyGraphBuilder.h"
......
...@@ -191,6 +191,7 @@ private: ...@@ -191,6 +191,7 @@ private:
class TDependencyGraphTraverser : angle::NonCopyable { class TDependencyGraphTraverser : angle::NonCopyable {
public: public:
TDependencyGraphTraverser() : mDepth(0) {} TDependencyGraphTraverser() : mDepth(0) {}
virtual ~TDependencyGraphTraverser() {}
virtual void visitSymbol(TGraphSymbol* symbol) {}; virtual void visitSymbol(TGraphSymbol* symbol) {};
virtual void visitArgument(TGraphArgument* selection) {}; virtual void visitArgument(TGraphArgument* selection) {};
......
...@@ -41,6 +41,7 @@ class GetVariableTraverser : angle::NonCopyable ...@@ -41,6 +41,7 @@ class GetVariableTraverser : angle::NonCopyable
{ {
public: public:
GetVariableTraverser(const TSymbolTable &symbolTable); GetVariableTraverser(const TSymbolTable &symbolTable);
virtual ~GetVariableTraverser() {}
template <typename VarT> template <typename VarT>
void traverse(const TType &type, const TString &name, std::vector<VarT> *output); void traverse(const TType &type, const TString &name, std::vector<VarT> *output);
......
...@@ -15,15 +15,15 @@ ...@@ -15,15 +15,15 @@
namespace egl namespace egl
{ {
class AttributeMap class AttributeMap final
{ {
public: public:
AttributeMap(); AttributeMap();
explicit AttributeMap(const EGLint *attributes); explicit AttributeMap(const EGLint *attributes);
virtual void insert(EGLint key, EGLint value); void insert(EGLint key, EGLint value);
virtual bool contains(EGLint key) const; bool contains(EGLint key) const;
virtual EGLint get(EGLint key, EGLint defaultValue) const; EGLint get(EGLint key, EGLint defaultValue) const;
typedef std::map<EGLint, EGLint>::const_iterator const_iterator; typedef std::map<EGLint, EGLint>::const_iterator const_iterator;
......
...@@ -47,7 +47,7 @@ class BinaryInputStream : angle::NonCopyable ...@@ -47,7 +47,7 @@ class BinaryInputStream : angle::NonCopyable
template <class IntT> template <class IntT>
IntT readInt() IntT readInt()
{ {
int value; int value = 0;
read(&value); read(&value);
return static_cast<IntT>(value); return static_cast<IntT>(value);
} }
...@@ -60,7 +60,7 @@ class BinaryInputStream : angle::NonCopyable ...@@ -60,7 +60,7 @@ class BinaryInputStream : angle::NonCopyable
bool readBool() bool readBool()
{ {
int value; int value = 0;
read(&value); read(&value);
return (value > 0); return (value > 0);
} }
......
...@@ -146,6 +146,7 @@ class FramebufferAttachmentObject ...@@ -146,6 +146,7 @@ class FramebufferAttachmentObject
{ {
public: public:
FramebufferAttachmentObject() {} FramebufferAttachmentObject() {}
virtual ~FramebufferAttachmentObject() {}
virtual GLsizei getAttachmentWidth(const FramebufferAttachment::Target &target) const = 0; virtual GLsizei getAttachmentWidth(const FramebufferAttachment::Target &target) const = 0;
virtual GLsizei getAttachmentHeight(const FramebufferAttachment::Target &target) const = 0; virtual GLsizei getAttachmentHeight(const FramebufferAttachment::Target &target) const = 0;
......
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