Enable warnings as errors for clang builds (#3012)

This fixes up the last of the clang errors that are unique to clang 10.
These take two forms, First, indentation that might indicate the mistaken
impression that a line is within an unbraced conditional block produces
a warning and is corrected in a few places. Second, a warning is
produced when a class has one of copy constructor or assignment operator
explicitly defined and the other left to implicit definition. The
solution is generally to add a definition with the = default assignment.

Finally, this adds the -Werror flag to all clang builds to keep the
build warnings clean and detect flaws that can affect all builds and
platforms.
This commit is contained in:
Greg Roth 2020-07-02 08:28:23 -07:00 коммит произвёл GitHub
Родитель 7c3fa86b07
Коммит a5843199c5
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
9 изменённых файлов: 15 добавлений и 15 удалений

Просмотреть файл

@ -58,7 +58,7 @@ before_install:
before_script: before_script:
- git submodule update --init - git submodule update --init
- if [ ${CC} = gcc ]; then CC=gcc-5; CXX=g++-5; fi - if [ ${CC} = gcc ]; then CC=gcc-5; CXX=g++-5; CXX_FLAGS=; else CXX_FLAGS=-Werror; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ulimit -Sn 1024; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ulimit -Sn 1024; fi
script: script:
@ -68,6 +68,7 @@ script:
-DSPIRV_BUILD_TESTS=ON -DSPIRV_BUILD_TESTS=ON
-DCMAKE_BUILD_TYPE=${DXC_BUILD_TYPE} -DCMAKE_BUILD_TYPE=${DXC_BUILD_TYPE}
-DCMAKE_C_COMPILER=${CC} -DCMAKE_CXX_COMPILER=${CXX} -DCMAKE_C_COMPILER=${CC} -DCMAKE_CXX_COMPILER=${CXX}
-DCMAKE_CXX_FLAGS=${CXX_FLAGS}
- ninja - ninja
- ./bin/dxc --help - ./bin/dxc --help
- ./bin/dxc -T ps_6_0 ../tools/clang/test/CodeGenSPIRV/passthru-ps.hlsl2spv - ./bin/dxc -T ps_6_0 ../tools/clang/test/CodeGenSPIRV/passthru-ps.hlsl2spv

Просмотреть файл

@ -40,7 +40,7 @@ before_build:
build_script: build_script:
- cmd: call utils\hct\hctbuild -%PLATFORM% -%CONFIGURATION% -spirvtest - cmd: call utils\hct\hctbuild -%PLATFORM% -%CONFIGURATION% -spirvtest
- sh: mkdir build && cd build - sh: mkdir build && cd build
- sh: cmake .. -GNinja $(cat ../utils/cmake-predefined-config-params) -DSPIRV_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ - sh: cmake .. -GNinja $(cat ../utils/cmake-predefined-config-params) -DSPIRV_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_FLAGS=-Werror
- sh: ninja - sh: ninja
test_script: test_script:

Просмотреть файл

@ -22,6 +22,7 @@ public:
using Kind = DXIL::InterpolationMode; using Kind = DXIL::InterpolationMode;
InterpolationMode(); InterpolationMode();
InterpolationMode(const InterpolationMode &Mode) = default;
InterpolationMode(Kind Kind); InterpolationMode(Kind Kind);
InterpolationMode(unsigned long long Kind); InterpolationMode(unsigned long long Kind);
InterpolationMode(bool bNoInterpolation, bool bLinear, bool bNoperspective, bool bCentroid, bool bSample); InterpolationMode(bool bNoInterpolation, bool bLinear, bool bNoperspective, bool bCentroid, bool bSample);

Просмотреть файл

@ -135,11 +135,6 @@ public:
return Bits != RHS.Bits; return Bits != RHS.Bits;
} }
const PackedVector &operator=(const PackedVector &RHS) {
Bits = RHS.Bits;
return *this;
}
PackedVector &operator|=(const PackedVector &RHS) { PackedVector &operator|=(const PackedVector &RHS) {
Bits |= RHS.Bits; Bits |= RHS.Bits;
return *this; return *this;

Просмотреть файл

@ -145,6 +145,8 @@ public:
WeakVH(const WeakVH &RHS) WeakVH(const WeakVH &RHS)
: ValueHandleBase(Weak, RHS) {} : ValueHandleBase(Weak, RHS) {}
WeakVH &operator=(const WeakVH &RHS) = default;
Value *operator=(Value *RHS) { Value *operator=(Value *RHS) {
return ValueHandleBase::operator=(RHS); return ValueHandleBase::operator=(RHS);
} }
@ -214,6 +216,7 @@ public:
#else #else
AssertingVH() : ThePtr(nullptr) {} AssertingVH() : ThePtr(nullptr) {}
AssertingVH(ValueTy *P) : ThePtr(GetAsValue(P)) {} AssertingVH(ValueTy *P) : ThePtr(GetAsValue(P)) {}
AssertingVH(const AssertingVH<ValueTy> &) = default;
#endif #endif
operator ValueTy*() const { operator ValueTy*() const {