Commit d2bdde2c by Nicolas Capens Committed by Nicolas Capens

Enable the -Wdeprecated-copy compiler warning

Remaining occurences of this warning have been fixed. Note the warning is also added by -Wextra so we previously explicitly disabled it with -Wno-deprecated-copy. While removing the latter should suffice to re- enable it, it's useful to make it explicit since support for implicit copy constructors when a user-defined assignment operator has been defined may be removed in the near future. Bug: b/191417833 Change-Id: If6721ae900afd530750a7d05ccc40365924d4c25 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/55028 Kokoro-Result: kokoro <noreply+kokoro@google.com> Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com>
parent 990e4b24
...@@ -424,6 +424,7 @@ else() ...@@ -424,6 +424,7 @@ else()
"-Wreorder" "-Wreorder"
"-Wsign-compare" "-Wsign-compare"
"-Wmissing-braces" "-Wmissing-braces"
"-Wdeprecated-copy" # implicit copy constructor for 'X' is deprecated because of user-declared copy assignment operator.
) )
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
...@@ -449,7 +450,7 @@ else() ...@@ -449,7 +450,7 @@ else()
endif() endif()
endif() endif()
# Disable pedanitc warnings # Disable pedantic warnings
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
list(APPEND SWIFTSHADER_COMPILE_OPTIONS list(APPEND SWIFTSHADER_COMPILE_OPTIONS
"-Wno-ignored-attributes" # ignoring attributes on template argument 'X' "-Wno-ignored-attributes" # ignoring attributes on template argument 'X'
...@@ -470,7 +471,6 @@ else() ...@@ -470,7 +471,6 @@ else()
"-Wno-undefined-var-template" # instantiation of variable 'X' required here, but no definition is available "-Wno-undefined-var-template" # instantiation of variable 'X' required here, but no definition is available
"-Wno-extra-semi" # extra ';' after member function definition "-Wno-extra-semi" # extra ';' after member function definition
"-Wno-unused-parameter" # unused parameter 'X' "-Wno-unused-parameter" # unused parameter 'X'
"-Wno-deprecated-copy" # implicit copy constructor for 'X' is deprecated because of user-declared copy assignment operator.
# Silence errors caused by unknown warnings when building with older # Silence errors caused by unknown warnings when building with older
# versions of Clang. This demands checking that warnings added above # versions of Clang. This demands checking that warnings added above
......
...@@ -325,12 +325,9 @@ union Color ...@@ -325,12 +325,9 @@ union Color
RGBA &operator=(const RGBA &other) RGBA &operator=(const RGBA &other)
{ {
if(this != &other)
{
this->r = other.r; this->r = other.r;
this->g = other.g; this->g = other.g;
this->b = other.b; this->b = other.b;
}
return *this; return *this;
} }
...@@ -350,12 +347,15 @@ union Color ...@@ -350,12 +347,15 @@ union Color
{ {
} }
Color &operator=(const Color &other) Color(const Color &other)
{
if(this != &other)
{ {
this->rgba = other.rgba; this->rgba = other.rgba;
} }
Color &operator=(const Color &other)
{
this->rgba = other.rgba;
return *this; return *this;
} }
......
...@@ -36,7 +36,7 @@ namespace sw ...@@ -36,7 +36,7 @@ namespace sw
float m41, float m42, float m43, float m44); float m41, float m42, float m43, float m44);
Matrix(const Vector &v1, const Vector &v2, const Vector &v3); // Column vectors Matrix(const Vector &v1, const Vector &v2, const Vector &v3); // Column vectors
Matrix &operator=(const Matrix &N); Matrix &operator=(const Matrix &N) = default;
// Row major order // Row major order
float m[4][4]; float m[4][4];
...@@ -181,18 +181,6 @@ namespace sw ...@@ -181,18 +181,6 @@ namespace sw
M(4, 1) = 0; M(4, 2) = 0; M(4, 3) = 0; M(4, 4) = 1; M(4, 1) = 0; M(4, 2) = 0; M(4, 3) = 0; M(4, 4) = 1;
} }
inline Matrix &Matrix::operator=(const Matrix &N)
{
Matrix &M = *this;
M(1, 1) = N(1, 1); M(1, 2) = N(1, 2); M(1, 3) = N(1, 3); M(1, 4) = N(1, 4);
M(2, 1) = N(2, 1); M(2, 2) = N(2, 2); M(2, 3) = N(2, 3); M(2, 4) = N(2, 4);
M(3, 1) = N(3, 1); M(3, 2) = N(3, 2); M(3, 3) = N(3, 3); M(3, 4) = N(3, 4);
M(4, 1) = N(4, 1); M(4, 2) = N(4, 2); M(4, 3) = N(4, 3); M(4, 4) = N(4, 4);
return M;
}
inline float *Matrix::operator[](int i) inline float *Matrix::operator[](int i)
{ {
return m[i]; return m[i];
......
...@@ -85,13 +85,6 @@ half::operator float() const ...@@ -85,13 +85,6 @@ half::operator float() const
return (float &)fp32i; return (float &)fp32i;
} }
half &half::operator=(half h)
{
fp16i = h.fp16i;
return *this;
}
half &half::operator=(float f) half &half::operator=(float f)
{ {
*this = half(f); *this = half(f);
......
...@@ -30,7 +30,6 @@ public: ...@@ -30,7 +30,6 @@ public:
operator float() const; operator float() const;
half &operator=(half h);
half &operator=(float f); half &operator=(float f);
private: private:
......
...@@ -426,13 +426,7 @@ private: ...@@ -426,13 +426,7 @@ private:
class Block { class Block {
public: public:
Block() = delete; Block() = delete;
Block &operator=(const Block &Rhs) { Block &operator=(const Block &Rhs) = default;
GlobalAbbrevs = Rhs.GlobalAbbrevs;
NumGlobalAbbrevs = Rhs.NumGlobalAbbrevs;
LocalAbbrevs = Rhs.LocalAbbrevs;
CodeAbbrev = Rhs.CodeAbbrev;
return *this;
}
Block(NaClBitstreamReader::BlockInfo *GlobalAbbrevs, Block(NaClBitstreamReader::BlockInfo *GlobalAbbrevs,
NaClBitcodeSelectorAbbrev &CodeAbbrev) NaClBitcodeSelectorAbbrev &CodeAbbrev)
: GlobalAbbrevs(GlobalAbbrevs), : GlobalAbbrevs(GlobalAbbrevs),
......
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