- Add DE_WARN_UNUSED_TYPE macro.
- Mark most commonly used types that have non-trivial ctor/dtor pair
but no intended side-effects with DE_WARN_UNUSED_TYPE.
Change-Id: I9af5c29fcacbec0d9bed0185b60552cb4bccf667
private:
T m_data[Size];
-};
+} DE_WARN_UNUSED_TYPE;
template <typename T, int Size>
int m_height;
int m_depth;
std::vector<deUint8> m_data;
-};
+} DE_WARN_UNUSED_TYPE;
void decompress (const PixelBufferAccess& dst, CompressedTexFormat fmt, const deUint8* src, const TexDecompressionParams& params = TexDecompressionParams());
deUint8 m_data[sizeof(First) > sizeof(Second) ? sizeof(First) : sizeof(Second)];
deUint64 m_align;
};
-};
+} DE_WARN_UNUSED_TYPE;
namespace EitherDetail
{
private:
StorageType m_value;
-};
+} DE_WARN_UNUSED_TYPE;
// Common floating-point types.
typedef Float<deUint16, 5, 10, 15, FLOAT_HAS_SIGN|FLOAT_SUPPORT_DENORM> Float16; //!< IEEE 754-2008 16-bit floating-point value
YesNoMaybe m_hasNaN; // Does the format support NaNs?
bool m_exactPrecision; // Are larger precisions disallowed?
double m_maxValue; // Largest representable finite value.
-};
+} DE_WARN_UNUSED_TYPE;
void FloatFormat_selfTest (void);
bool m_hasNaN;
double m_lo;
double m_hi;
-};
+} DE_WARN_UNUSED_TYPE;
inline Interval operator+ (const Interval& x) { return x; }
Interval exp2 (const Interval& x);
private:
Vector<Vector<T, Rows>, Cols> m_data;
-};
+} DE_WARN_UNUSED_TYPE;
// Operators.
deUint8 m_data[sizeof(T)];
deUint64 m_align;
};
-};
+} DE_WARN_UNUSED_TYPE;
template<typename T>
Maybe<T> nothing (void)
{
return !(*this == other);
}
-};
+} DE_WARN_UNUSED_TYPE;
} // namespace tcu
private:
deUint32 m_value;
-};
+} DE_WARN_UNUSED_TYPE;
inline bool compareEqualMasked (RGBA a, RGBA b, deUint32 cmpMask)
{
std::string m_prefix;
qpTestResult m_result;
std::string m_message;
-};
+} DE_WARN_UNUSED_TYPE;
} // tcu
private:
deUint32 m_hash;
-};
+} DE_WARN_UNUSED_TYPE;
SeedBuilder& operator<< (SeedBuilder& builder, bool value);
SeedBuilder& operator<< (SeedBuilder& builder, deInt8 value);
StringTemplate& operator= (const StringTemplate&); // not allowed!
std::string m_template;
-};
+} DE_WARN_UNUSED_TYPE;
} // tcu
int m_width;
int m_height;
std::vector<deUint32> m_pixels;
-};
+} DE_WARN_UNUSED_TYPE;
inline void Surface::setPixel (int x, int y, RGBA col)
{
, resultBits (16)
{
}
-};
+} DE_WARN_UNUSED_TYPE;
bool isTexCompareResultValid (const Texture2DView& texture, const Sampler& sampler, const TexComparePrecision& prec, const Vec2& coord, const Vec2& lodBounds, const float cmpReference, const float result);
bool isTexCompareResultValid (const TextureCubeView& texture, const Sampler& sampler, const TexComparePrecision& prec, const Vec3& coord, const Vec2& lodBounds, const float cmpReference, const float result);
{
return (order != other.order || type != other.type);
}
-};
+} DE_WARN_UNUSED_TYPE;
/*--------------------------------------------------------------------*//*!
* \brief Sampling parameters
, seamlessCubeMap (false)
{
}
-};
+} DE_WARN_UNUSED_TYPE;
// Calculate pitches for pixel data with no padding.
IVec3 calculatePackedPitch (const TextureFormat& format, const IVec3& size);
IVec3 m_size;
IVec3 m_pitch; //!< (pixelPitch, rowPitch, slicePitch)
mutable void* m_data;
-};
+} DE_WARN_UNUSED_TYPE;
/*--------------------------------------------------------------------*//*!
* \brief Read-write pixel data access
void setPixDepth (float depth, int x, int y, int z = 0) const;
void setPixStencil (int stencil, int x, int y, int z = 0) const;
-};
+} DE_WARN_UNUSED_TYPE;
/*--------------------------------------------------------------------*//*!
* \brief Generic pixel data container
de::ArrayBuffer<deUint8> m_data;
friend class ConstPixelBufferAccess;
-};
+} DE_WARN_UNUSED_TYPE;
Vec4 sampleLevelArray1D (const ConstPixelBufferAccess* levels, int numLevels, const Sampler& sampler, float s, int level, float lod);
Vec4 sampleLevelArray2D (const ConstPixelBufferAccess* levels, int numLevels, const Sampler& sampler, float s, float t, int depth, float lod);
CubeFaceCoords (CubeFace face_, T s_, T t_) : face(face_), s(s_), t(t_) {}
CubeFaceCoords (CubeFace face_, const Vector<T, 2>& c) : face(face_), s(c.x()), t(c.y()) {}
-};
+} DE_WARN_UNUSED_TYPE;
typedef CubeFaceCoords<float> CubeFaceFloatCoords;
typedef CubeFaceCoords<int> CubeFaceIntCoords;
protected:
int m_numLevels;
const ConstPixelBufferAccess* m_levels;
-};
+} DE_WARN_UNUSED_TYPE;
inline Texture1DView::Texture1DView (int numLevels, const ConstPixelBufferAccess* levels)
: m_numLevels (numLevels)
protected:
int m_numLevels;
const ConstPixelBufferAccess* m_levels;
-};
+} DE_WARN_UNUSED_TYPE;
inline Texture2DView::Texture2DView (int numLevels, const ConstPixelBufferAccess* levels)
: m_numLevels (numLevels)
TextureFormat m_format;
std::vector<LevelData> m_data;
std::vector<PixelBufferAccess> m_access;
-};
+} DE_WARN_UNUSED_TYPE;
/*--------------------------------------------------------------------*//*!
* \brief 1D Texture reference implementation
private:
int m_width;
Texture1DView m_view;
-};
+} DE_WARN_UNUSED_TYPE;
inline Vec4 Texture1D::sample (const Sampler& sampler, float s, float lod) const
{
int m_width;
int m_height;
Texture2DView m_view;
-};
+} DE_WARN_UNUSED_TYPE;
inline Vec4 Texture2D::sample (const Sampler& sampler, float s, float t, float lod) const
{
protected:
int m_numLevels;
const ConstPixelBufferAccess* m_levels[CUBEFACE_LAST];
-};
+} DE_WARN_UNUSED_TYPE;
/*--------------------------------------------------------------------*//*!
* \brief Cube Map Texture reference implementation
std::vector<LevelData> m_data[CUBEFACE_LAST];
std::vector<PixelBufferAccess> m_access[CUBEFACE_LAST];
TextureCubeView m_view;
-};
+} DE_WARN_UNUSED_TYPE;
inline Vec4 TextureCube::sample (const Sampler& sampler, float s, float t, float p, float lod) const
{
int m_numLevels;
const ConstPixelBufferAccess* m_levels;
-};
+} DE_WARN_UNUSED_TYPE;
/*--------------------------------------------------------------------*//*!
* \brief 2D Array Texture View
int m_numLevels;
const ConstPixelBufferAccess* m_levels;
-};
+} DE_WARN_UNUSED_TYPE;
/*--------------------------------------------------------------------*//*!
* \brief 1D Array Texture reference implementation
int m_width;
int m_numLayers;
Texture1DArrayView m_view;
-};
+} DE_WARN_UNUSED_TYPE;
inline Vec4 Texture1DArray::sample (const Sampler& sampler, float s, float t, float lod) const
{
int m_height;
int m_numLayers;
Texture2DArrayView m_view;
-};
+} DE_WARN_UNUSED_TYPE;
inline Vec4 Texture2DArray::sample (const Sampler& sampler, float s, float t, float r, float lod) const
{
protected:
int m_numLevels;
const ConstPixelBufferAccess* m_levels;
-};
+} DE_WARN_UNUSED_TYPE;
inline Vec4 Texture3DView::sample (const Sampler& sampler, float s, float t, float r, float lod) const
{
int m_height;
int m_depth;
Texture3DView m_view;
-};
+} DE_WARN_UNUSED_TYPE;
inline Vec4 Texture3D::sample (const Sampler& sampler, float s, float t, float r, float lod) const
{
int m_numLevels;
const ConstPixelBufferAccess* m_levels;
-};
+} DE_WARN_UNUSED_TYPE;
/*--------------------------------------------------------------------*//*!
* \brief Cube Map Array Texture reference implementation
int m_size;
int m_depth;
TextureCubeArrayView m_view;
-};
+} DE_WARN_UNUSED_TYPE;
inline Vec4 TextureCubeArray::sample (const Sampler& sampler, float s, float t, float r, float q, float lod) const
{
, lookupBias (lookupBias_)
{
}
-};
+} DE_WARN_UNUSED_TYPE;
TextureFormatInfo getTextureFormatInfo (const TextureFormat& format);
IVec4 getTextureFormatBitDepth (const TextureFormat& format);
template <int NewSize>
Vector<T, NewSize> toWidth (void) const;
-};
+} DE_WARN_UNUSED_TYPE;
template <typename T, int Size>
inline Vector<T, Size>::Vector (void)
private:
void* m_ptr;
size_t m_cap;
-};
+} DE_WARN_UNUSED_TYPE;
template <typename T, size_t Alignment, size_t Stride>
ArrayBuffer<T,Alignment,Stride>::ArrayBuffer (void) throw()
Mutex m_readLock;
volatile deUint32 m_canceled;
-};
+} DE_WARN_UNUSED_TYPE;
template <typename T>
BlockBuffer<T>::BlockBuffer (int blockSize, int numBlocks)
# define DE_EMPTY_CPP_FILE
#endif
+// Warn if type is constructed, but left unused
+//
+// Used in types with non-trivial ctor/dtor but with ctor-dtor pair causing no (observable)
+// side-effects.
+//
+// \todo add attribute for GCC
+#if (DE_COMPILER == DE_COMPILER_CLANG) && defined(__has_attribute)
+# if __has_attribute(warn_unused)
+# define DE_WARN_UNUSED_TYPE __attribute__((warn_unused))
+# else
+# define DE_WARN_UNUSED_TYPE
+# endif
+#else
+# define DE_WARN_UNUSED_TYPE
+#endif
+
#endif // _DEDEFS_HPP
private:
deRandom m_rnd;
-};
+} DE_WARN_UNUSED_TYPE;
// Inline implementations
const glw::Functions& m_gl;
tcu::TestLog& m_log;
bool m_enableLog;
-};
+} DE_WARN_UNUSED_TYPE;
} // glu
, data (0)
{
}
-};
+} DE_WARN_UNUSED_TYPE;
struct VertexArrayBinding
{
VertexArrayBinding (void)
{
}
-};
+} DE_WARN_UNUSED_TYPE;
struct PrimitiveList
{
, indices (0)
{
}
-};
+} DE_WARN_UNUSED_TYPE;
class DrawUtilCallback
{
private:
ObjectWrapper (const ObjectWrapper& other);
ObjectWrapper& operator= (const ObjectWrapper& other);
-};
+} DE_WARN_UNUSED_TYPE;
/*--------------------------------------------------------------------*//*!
* \brief API object wrapper template.
TypedObjectWrapper (const glw::Functions& gl, deUint32 object) : ObjectWrapper(gl, objectTraits(Type), object) {}
explicit TypedObjectWrapper (const RenderContext& context) : ObjectWrapper(context.getFunctions(), objectTraits(Type)) {}
explicit TypedObjectWrapper (const glw::Functions& gl) : ObjectWrapper(gl, objectTraits(Type)) {}
-};
+} DE_WARN_UNUSED_TYPE;
/*--------------------------------------------------------------------*//*!
* \brief API object vector.
const glw::Functions& m_gl;
const ObjectTraits& m_traits;
std::vector<deUint32> m_objects;
-};
+} DE_WARN_UNUSED_TYPE;
template<ObjectType Type> class TypedObjectVector : public ObjectVector
{
, numSamples (DONT_CARE)
{
}
-};
+} DE_WARN_UNUSED_TYPE;
// Utilities
MINOR_SHIFT = MAJOR_SHIFT+MAJOR_BITS,
PROFILE_SHIFT = MINOR_SHIFT+MINOR_BITS
};
-};
+} DE_WARN_UNUSED_TYPE;
inline deUint32 ApiType::pack (int major, int minor, Profile profile)
{
TOTAL_CONTEXT_BITS = TOTAL_API_BITS+FLAGS_BITS,
FLAGS_SHIFT = TOTAL_API_BITS
};
-};
+} DE_WARN_UNUSED_TYPE;
inline ContextType::ContextType (int major, int minor, Profile profile, ContextFlags flags)
: ApiType(major, minor, profile)
deUint32 m_format; //!< Internal format.
tcu::Texture1D m_refTexture;
deUint32 m_glTexture;
-};
+} DE_WARN_UNUSED_TYPE;
/*--------------------------------------------------------------------*//*!
* \brief 2D Texture
tcu::Texture2D m_refTexture;
deUint32 m_glTexture;
-};
+} DE_WARN_UNUSED_TYPE;
/*--------------------------------------------------------------------*//*!
* \brief Cube Map Texture
tcu::TextureCube m_refTexture;
deUint32 m_glTexture;
-};
+} DE_WARN_UNUSED_TYPE;
/*--------------------------------------------------------------------*//*!
* \brief 2D Array Texture
tcu::Texture2DArray m_refTexture;
deUint32 m_glTexture;
-};
+} DE_WARN_UNUSED_TYPE;
/*--------------------------------------------------------------------*//*!
* \brief 1D Array Texture
tcu::Texture1DArray m_refTexture;
deUint32 m_glTexture;
-};
+} DE_WARN_UNUSED_TYPE;
/*--------------------------------------------------------------------*//*!
* \brief 3D Texture
tcu::Texture3D m_refTexture;
deUint32 m_glTexture;
-};
+} DE_WARN_UNUSED_TYPE;
/*--------------------------------------------------------------------*//*!
* \brief Cube Map Array Texture
tcu::TextureCubeArray m_refTexture;
deUint32 m_glTexture;
-};
+} DE_WARN_UNUSED_TYPE;
/*--------------------------------------------------------------------*//*!
* \brief 1D Texture Buffer only supported on OpenGL
tcu::PixelBufferAccess m_refTexture;
deUint32 m_glTexture;
deUint32 m_glBuffer;
-};
+} DE_WARN_UNUSED_TYPE;
} // glu
, dataType (dataType_)
{
}
-};
+} DE_WARN_UNUSED_TYPE;
tcu::TextureFormat mapGLTransferFormat (deUint32 format, deUint32 dataType);
tcu::TextureFormat mapGLInternalFormat (deUint32 internalFormat);
array.size = 0;
};
} m_data;
-};
+} DE_WARN_UNUSED_TYPE;
template <typename T>
inline VarType varTypeOf (Precision prec = PRECISION_LAST) { return VarType(dataTypeOf<T>(), prec); }
private:
std::string m_name;
VarType m_type;
-};
+} DE_WARN_UNUSED_TYPE;
class StructType
{
private:
std::string m_typeName;
std::vector<StructMember> m_members;
-};
+} DE_WARN_UNUSED_TYPE;
enum Storage
{
int offset;
FormatLayout format;
MatrixOrder matrixOrder;
-};
+} DE_WARN_UNUSED_TYPE;
struct VariableDeclaration
{
VarType varType;
deUint32 memoryAccessQualifierBits;
std::string name;
-};
+} DE_WARN_UNUSED_TYPE;
struct InterfaceBlock
{
std::string instanceName;
std::vector<glu::VariableDeclaration> variables;
std::vector<int> dimensions;
-};
+} DE_WARN_UNUSED_TYPE;
//! Internals for declare() utilities.
namespace decl
private:
const glu::ContextType m_type;
-};
+} DE_WARN_UNUSED_TYPE;
} // sglr
std::set<deUint32> m_allocatedBuffers;
std::set<deUint32> m_allocatedVaos;
std::vector<glu::ShaderProgram*> m_programs;
-};
+} DE_WARN_UNUSED_TYPE;
} // sglr
rr::FragmentProcessor m_fragmentProcessor;
std::vector<rr::Fragment> m_fragmentBuffer;
std::vector<float> m_fragmentDepths;
-};
+} DE_WARN_UNUSED_TYPE;
} // sglr
friend class ReferenceContext; // for uniform access
friend class GLContext; // for source string access
-};
+} DE_WARN_UNUSED_TYPE;
} // sglr
, sampleDepths (DE_NULL)
{
}
-};
+} DE_WARN_UNUSED_TYPE;
// These functions are for clearing only a specific pixel rectangle in a multisample buffer.
// When clearing the entire buffer, tcu::clear, tcu::clearDepth and tcu::clearStencil can be used.
void executeUnsignedValueWrite (int fragNdxOffset, int numSamplesPerFragment, const Fragment* inputFragments, const tcu::BVec4& colorMask, const tcu::PixelBufferAccess& colorBuffer);
SampleData m_sampleRegister[SAMPLE_REGISTER_SIZE];
-};
+} DE_WARN_UNUSED_TYPE;
} // rr
template<typename ScalarType>
inline const ScalarType* getAccess () const;
-};
+} DE_WARN_UNUSED_TYPE;
template<>
inline float* GenericVec4::getAccess<float> ()
private:
tcu::PixelBufferAccess m_access;
-};
+} DE_WARN_UNUSED_TYPE;
/*--------------------------------------------------------------------*//*!
* \brief Read-only pixel data access to multisampled buffers.
private:
tcu::ConstPixelBufferAccess m_access;
-};
+} DE_WARN_UNUSED_TYPE;
// Multisampled versions of tcu-utils
VertexPacket* v2;
int provokingIndex;
-};
+} DE_WARN_UNUSED_TYPE;
struct Triangles
{
{
return vertices / 3;
}
-};
+} DE_WARN_UNUSED_TYPE;
struct TriangleStrip
{
{
return (vertices < 3) ? (0) : (vertices - 2);
}
-};
+} DE_WARN_UNUSED_TYPE;
struct TriangleFan
{
{
return (vertices < 3) ? (0) : (vertices - 2);
}
-};
+} DE_WARN_UNUSED_TYPE;
struct Line
{
VertexPacket* v1;
int provokingIndex;
-};
+} DE_WARN_UNUSED_TYPE;
struct Lines
{
{
return vertices / 2;
}
-};
+} DE_WARN_UNUSED_TYPE;
struct LineStrip
{
{
return (vertices < 2) ? (0) : (vertices - 1);
}
-};
+} DE_WARN_UNUSED_TYPE;
struct LineLoop
{
{
return (vertices < 2) ? (0) : (vertices);
}
-};
+} DE_WARN_UNUSED_TYPE;
struct Point
{
}
VertexPacket* v0;
-};
+} DE_WARN_UNUSED_TYPE;
struct Points
{
{
return (vertices);
}
-};
+} DE_WARN_UNUSED_TYPE;
struct LineAdjacency
{
VertexPacket* v3;
int provokingIndex;
-};
+} DE_WARN_UNUSED_TYPE;
struct LinesAdjacency
{
{
return vertices / 4;
}
-};
+} DE_WARN_UNUSED_TYPE;
struct LineStripAdjacency
{
{
return (vertices < 4) ? (0) : (vertices - 3);
}
-};
+} DE_WARN_UNUSED_TYPE;
struct TriangleAdjacency
{
VertexPacket* v5; //!< adjacent
int provokingIndex;
-};
+} DE_WARN_UNUSED_TYPE;
struct TrianglesAdjacency
{
{
return vertices / 6;
}
-};
+} DE_WARN_UNUSED_TYPE;
struct TriangleStripAdjacency
{
{
return (vertices < 6) ? 0 : ((vertices - 4) / 2);
}
-};
+} DE_WARN_UNUSED_TYPE;
} // pa
} // rr
{
int primitiveIDIn;
const VertexPacket* vertices[6];
-};
+} DE_WARN_UNUSED_TYPE;
/*--------------------------------------------------------------------*//*!
* \brief Geometry emitter
size_t m_numEmitted;
size_t m_maxVertices;
-};
+} DE_WARN_UNUSED_TYPE;
} // rr
tcu::IVec2 m_bboxMin; //!< Bounding box min (inclusive).
tcu::IVec2 m_bboxMax; //!< Bounding box max (inclusive).
tcu::IVec2 m_curPos; //!< Current rasterization position.
-};
+} DE_WARN_UNUSED_TYPE;
/*--------------------------------------------------------------------*//*!
tcu::IVec2 m_curPos; //!< Current rasterization position.
deInt32 m_curRowFragment; //!< Current rasterization position of one fragment in column of lineWidth fragments
float m_lineWidth;
-};
+} DE_WARN_UNUSED_TYPE;
/*--------------------------------------------------------------------*//*!
// Per-line rasterization state.
TriangleRasterizer m_triangleRasterizer0; //!< not in array because we want to initialize these in the initialization list
TriangleRasterizer m_triangleRasterizer1;
-};
+} DE_WARN_UNUSED_TYPE;
/*--------------------------------------------------------------------*//*!
const int numColorBuffers;
const MultisamplePixelBufferAccess depthBuffer;
const MultisamplePixelBufferAccess stencilBuffer;
-};
+} DE_WARN_UNUSED_TYPE;
struct Program
{
const VertexShader* vertexShader;
const FragmentShader* fragmentShader;
const GeometryShader* geometryShader;
-};
+} DE_WARN_UNUSED_TYPE;
struct DrawIndices
{
const void* const indices;
const IndexType indexType;
const int baseVertex;
-};
+} DE_WARN_UNUSED_TYPE;
class PrimitiveList
{
const VertexAttrib* const vertexAttribs;
const PrimitiveList& primitives;
-};
+} DE_WARN_UNUSED_TYPE;
class Renderer
{
void draw (const DrawCommand& command) const;
void drawInstanced (const DrawCommand& command, int numInstances) const;
-};
+} DE_WARN_UNUSED_TYPE;
} // rr
std::vector<VertexInputInfo> m_inputs;
std::vector<VertexOutputInfo> m_outputs;
-};
+} DE_WARN_UNUSED_TYPE;
/*--------------------------------------------------------------------*//*!
* \brief Fragment shader interface
std::vector<FragmentInputInfo> m_inputs;
std::vector<FragmentOutputInfo> m_outputs;
-};
+} DE_WARN_UNUSED_TYPE;
/*--------------------------------------------------------------------*//*!
* \brief Geometry shader input primitive type
std::vector<GeometryInputInfo> m_inputs;
std::vector<GeometryOutputInfo> m_outputs;
-};
+} DE_WARN_UNUSED_TYPE;
// Helpers for shader implementations.
, generic (generic_)
{
}
-};
+} DE_WARN_UNUSED_TYPE;
bool isValidVertexAttrib (const VertexAttrib& vertexAttrib);
// \todo [2013-04-01 pyry] Queries: isReadFloatValid(), isReadIntValid() ...
friend class VertexPacketAllocator;
-};
+} DE_WARN_UNUSED_TYPE;
/*--------------------------------------------------------------------*//*!
const size_t m_numberOfVertexOutputs;
std::vector<deInt8*> m_allocations;
std::vector<VertexPacket*> m_singleAllocPool;
-};
+} DE_WARN_UNUSED_TYPE;
} // rr