Skip to content

Commit

Permalink
Merge pull request #692 from LebedevRI/ci-llvm18
Browse files Browse the repository at this point in the history
CI: LLVM18
  • Loading branch information
LebedevRI authored Mar 16, 2024
2 parents 9a8df83 + b5c16e3 commit 28fd2d5
Show file tree
Hide file tree
Showing 58 changed files with 262 additions and 242 deletions.
3 changes: 2 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Checks: >
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-c-copy-assignment-signature,
-cppcoreguidelines-explicit-virtual-functions,
-cppcoreguidelines-macro-to-enum,
-cppcoreguidelines-noexcept-destructor,
-cppcoreguidelines-noexcept-move-operations,
-cppcoreguidelines-noexcept-swap,
Expand Down Expand Up @@ -118,11 +119,11 @@ Checks: >
-readability-implicit-bool-conversion,
-readability-inconsistent-declaration-parameter-name,
-readability-magic-numbers,
-readability-avoid-nested-conditional-operator,
-rawspeed-std-array-no-operator-at
WarningsAsErrors: '*'
HeaderFilterRegex: '.*'
AnalyzeTemporaryDtors: false
InheritParentConfig: false
User: lebedevri
CheckOptions:
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/CI-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ jobs:
APT::Get::Fix-Missing "true";
EOT
rm -rf /etc/apt/sources.list*
if [ "${{ inputs.distro }}" = "debian:trixie-slim" ]; then
if [ "${{ inputs.distro }}" = "debian:unstable-slim" ]; then
tee /etc/apt/sources.list > /dev/null <<EOT
deb http://debian-archive.trafficmanager.net/debian unstable main
EOT
elif [ "${{ inputs.distro }}" = "debian:trixie-slim" ]; then
tee /etc/apt/sources.list > /dev/null <<EOT
deb http://debian-archive.trafficmanager.net/debian trixie main
deb http://debian-archive.trafficmanager.net/debian trixie-updates main
Expand Down Expand Up @@ -141,8 +145,8 @@ jobs:
eatmydata apt-get install clang-format-${{ inputs.compiler-version }} clang-tidy-${{ inputs.compiler-version }}
eatmydata apt-get install curl gpg
echo 'deb https://mirror.aardsoft.fi/opensuse/repositories/graphics:/darktable:/master/Debian_Testing/ /' | tee /etc/apt/sources.list
curl -fsSL https://download.opensuse.org/repositories/graphics:darktable:master/Debian_Testing/Release.key | gpg --dearmor | tee /etc/apt/trusted.gpg.d/graphics_darktable_master.gpg > /dev/null
echo 'deb http://download.opensuse.org/repositories/graphics:/darktable:/master/Debian_Unstable/ /' | tee /etc/apt/sources.list
curl -fsSL https://download.opensuse.org/repositories/graphics:darktable:master/Debian_Unstable/Release.key | gpg --dearmor | tee /etc/apt/trusted.gpg.d/graphics_darktable_master.gpg > /dev/null
apt-get update
eatmydata apt-get install rawspeed-clang-tidy-module
fi
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
os: [ linux ]
compiler:
- { distro: "debian:trixie-slim", family: GNU, version: 13, CC: gcc-13, CXX: g++-13 }
- { distro: "debian:trixie-slim", family: LLVM, version: 17, CC: clang-17, CXX: clang++-17 }
- { distro: "debian:unstable-slim", family: LLVM, version: 18, CC: clang-18, CXX: clang++-18 }
flavor: [ ReleaseWithAsserts, Release ]
uses: ./.github/workflows/CI-linux.yml
with:
Expand All @@ -54,6 +54,7 @@ jobs:
os: [ linux ]
compiler:
- { distro: "debian:bookworm-slim", family: GNU, version: 12, CC: gcc-12, CXX: g++-12 }
- { distro: "debian:trixie-slim", family: LLVM, version: 17, CC: clang-17, CXX: clang++-17 }
- { distro: "debian:bookworm-slim", family: LLVM, version: 16, CC: clang-16, CXX: clang++-16 }
- { distro: "debian:bookworm-slim", family: LLVM, version: 15, CC: clang-15, CXX: clang++-15 }
flavor: [ ReleaseWithAsserts, Release ]
Expand All @@ -74,16 +75,16 @@ jobs:
matrix:
include:
- os: linux
compiler: { distro: "debian:trixie-slim", family: LLVM, version: 17, CC: clang-17, CXX: clang++-17, CLANG_TIDY: clang-tidy-17 }
compiler: { distro: "debian:unstable-slim", family: LLVM, version: 18, CC: clang-18, CXX: clang++-18, CLANG_TIDY: clang-tidy-18 }
flavor: ClangTidy
- os: linux
compiler: { distro: "debian:trixie-slim", family: LLVM, version: 17, CC: clang-17, CXX: clang++-17 }
compiler: { distro: "debian:unstable-slim", family: LLVM, version: 18, CC: clang-18, CXX: clang++-18 }
flavor: ClangStaticAnalysis
- os: linux
compiler: { distro: "debian:trixie-slim", family: LLVM, version: 17, CC: clang-17, CXX: clang++-17 }
compiler: { distro: "debian:unstable-slim", family: LLVM, version: 18, CC: clang-18, CXX: clang++-18 }
flavor: ClangCTUStaticAnalysis
- os: linux
compiler: { distro: "debian:trixie-slim", family: LLVM, version: 17, CC: clang-17, CXX: clang++-17 }
compiler: { distro: "debian:unstable-slim", family: LLVM, version: 18, CC: clang-18, CXX: clang++-18 }
flavor: CodeQLAnalysis
uses: ./.github/workflows/CI-linux.yml
with:
Expand Down Expand Up @@ -125,7 +126,7 @@ jobs:
matrix:
include:
- os: linux
compiler: { distro: "debian:trixie-slim", family: LLVM, version: 17, CC: clang-17, CXX: clang++-17 }
compiler: { distro: "debian:unstable-slim", family: LLVM, version: 18, CC: clang-18, CXX: clang++-18 }
flavor: SonarCloudStaticAnalysis
uses: ./.github/workflows/CI-linux.yml
with:
Expand Down
6 changes: 3 additions & 3 deletions fuzz/librawspeed/bitstreams/BitVacuumerRoundtrip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,17 @@ class InputWrapper final {
InputWrapper& operator=(const InputWrapper&) = delete;
InputWrapper& operator=(InputWrapper&&) = delete;

inline InputWrapper(ByteStream bitLengths_, ByteStream bitVals_)
InputWrapper(ByteStream bitLengths_, ByteStream bitVals_)
: bitLengths(bitLengths_), bitVals(bitVals_) {
invariant(size() >= 0);
}

[[nodiscard]] inline int size() const RAWSPEED_READNONE {
[[nodiscard]] int size() const RAWSPEED_READNONE {
invariant(bitVals.getSize() == 4 * bitLengths.getSize());
return bitLengths.getSize();
}

[[nodiscard]] inline std::pair<uint32_t, int>
[[nodiscard]] std::pair<uint32_t, int>
operator[](int i) const RAWSPEED_READNONE {
invariant(i >= 0);
invariant(i < size());
Expand Down
4 changes: 2 additions & 2 deletions src/librawspeed/adt/Array1DRef.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ template <class T> class Array1DRef final {
template <typename T2>
requires(!std::is_const_v<T2> && std::is_const_v<T> &&
std::is_same_v<std::remove_const_t<T>, std::remove_const_t<T2>>)
inline Array1DRef(Array1DRef<T2> RHS) // NOLINT(google-explicit-constructor)
Array1DRef(Array1DRef<T2> RHS) // NOLINT(google-explicit-constructor)
: Array1DRef(RHS.data, RHS.numElts) {}

// Const-preserving conversion from Array1DRef<T> to Array1DRef<std::byte>.
Expand All @@ -74,7 +74,7 @@ template <class T> class Array1DRef final {
!(std::is_const_v<T2> && !std::is_const_v<T>) &&
!(std::is_same_v<std::remove_const_t<T>, std::remove_const_t<T2>>) &&
std::is_same_v<std::remove_const_t<T>, std::byte>)
inline Array1DRef(Array1DRef<T2> RHS) // NOLINT(google-explicit-constructor)
Array1DRef(Array1DRef<T2> RHS) // NOLINT(google-explicit-constructor)
: Array1DRef(reinterpret_cast<T*>(RHS.data), sizeof(T2) * RHS.numElts) {}

[[nodiscard]] CroppedArray1DRef<T> getCrop(int offset, int numElts) const;
Expand Down
10 changes: 5 additions & 5 deletions src/librawspeed/adt/Array2DRef.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ template <class T> class Array2DRef final {
template <typename T2>
requires(!std::is_const_v<T2> && std::is_const_v<T> &&
std::is_same_v<std::remove_const_t<T>, std::remove_const_t<T2>>)
inline Array2DRef(Array2DRef<T2> RHS) // NOLINT(google-explicit-constructor)
Array2DRef(Array2DRef<T2> RHS) // NOLINT(google-explicit-constructor)
: Array2DRef(RHS.data, RHS._width, RHS._height, RHS._pitch) {}

// Const-preserving conversion from Array2DRef<T> to Array2DRef<std::byte>.
Expand All @@ -87,13 +87,13 @@ template <class T> class Array2DRef final {
!(std::is_const_v<T2> && !std::is_const_v<T>) &&
!(std::is_same_v<std::remove_const_t<T>, std::remove_const_t<T2>>) &&
std::is_same_v<std::remove_const_t<T>, std::byte>)
inline Array2DRef(Array2DRef<T2> RHS) // NOLINT(google-explicit-constructor)
Array2DRef(Array2DRef<T2> RHS) // NOLINT(google-explicit-constructor)
: Array2DRef(RHS.data, sizeof(T2) * RHS._width, RHS._height,
sizeof(T2) * RHS._pitch) {}

template <typename AllocatorType =
typename std::vector<cvless_value_type>::allocator_type>
inline static Array2DRef<T>
static Array2DRef<T>
create(std::vector<cvless_value_type, AllocatorType>& storage, int width,
int height) {
using VectorTy = std::remove_reference_t<decltype(storage)>;
Expand All @@ -110,8 +110,8 @@ template <class T> class Array2DRef final {

// CTAD deduction guide
template <typename T>
explicit Array2DRef(Array1DRef<T> data, int width, int height, int pitch)
-> Array2DRef<T>;
explicit Array2DRef(Array1DRef<T> data, int width, int height,
int pitch) -> Array2DRef<T>;

// CTAD deduction guide
template <typename T>
Expand Down
1 change: 1 addition & 0 deletions src/librawspeed/adt/Bit.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <algorithm>
#include <bit>
#include <climits>
#include <concepts>
#include <cstdint>
#include <type_traits>

Expand Down
3 changes: 1 addition & 2 deletions src/librawspeed/adt/BitIterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ struct BitMSBIterator final {
invariant(bitIdx >= -1);
return *this;
}
friend inline bool operator==(const BitMSBIterator& a,
const BitMSBIterator& b) {
friend bool operator==(const BitMSBIterator& a, const BitMSBIterator& b) {
invariant(a.bitsPat == b.bitsPat && "Comparing unrelated iterators.");
return a.bitIdx == b.bitIdx;
}
Expand Down
19 changes: 10 additions & 9 deletions src/librawspeed/adt/CoalescingOutputIterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@
#include "adt/Invariant.h"
#include "io/Endianness.h"
#include <concepts>
#include <cstddef>
#include <cstdint>
#include <iterator>
#include <type_traits>

namespace rawspeed {

Expand All @@ -45,13 +47,13 @@ class CoalescingOutputIterator {

static constexpr int MaxOccupancy = bitwidth<CoalescedType>();

inline void establishClassInvariants() const {
void establishClassInvariants() const {
invariant(occupancy >= 0);
invariant(occupancy <= MaxOccupancy);
invariant(occupancy % bitwidth<PartType>() == 0);
}

inline void maybeOutputCoalescedParts() {
void maybeOutputCoalescedParts() {
establishClassInvariants();
invariant(occupancy > 0);
if (occupancy != MaxOccupancy)
Expand Down Expand Up @@ -79,8 +81,7 @@ class CoalescingOutputIterator {

template <typename U>
requires std::same_as<UnderlyingOutputIterator, std::remove_reference_t<U>>
inline explicit CoalescingOutputIterator(U&& it_)
: it(std::forward<U>(it_)) {}
explicit CoalescingOutputIterator(U&& it_) : it(std::forward<U>(it_)) {}

CoalescingOutputIterator(const CoalescingOutputIterator& other)
: it(other.it) {
Expand All @@ -107,7 +108,7 @@ class CoalescingOutputIterator {
return *this;
}

inline ~CoalescingOutputIterator() {
~CoalescingOutputIterator() {
establishClassInvariants();
if (occupancy == 0)
return;
Expand All @@ -120,25 +121,25 @@ class CoalescingOutputIterator {
invariant(occupancy == 0);
}

[[nodiscard]] inline CoalescingOutputIterator& operator*() {
[[nodiscard]] CoalescingOutputIterator& operator*() {
establishClassInvariants();
return *this;
}

inline CoalescingOutputIterator& operator++() {
CoalescingOutputIterator& operator++() {
establishClassInvariants();
return *this;
}

// NOLINTNEXTLINE(cert-dcl21-cpp)
inline CoalescingOutputIterator operator++(int) {
CoalescingOutputIterator operator++(int) {
establishClassInvariants();
return *this;
}

template <typename U>
requires std::same_as<U, PartType>
inline CoalescingOutputIterator& operator=(U part) {
CoalescingOutputIterator& operator=(U part) {
establishClassInvariants();
invariant(occupancy < MaxOccupancy);
invariant(occupancy + bitwidth<U>() <= MaxOccupancy);
Expand Down
8 changes: 4 additions & 4 deletions src/librawspeed/adt/CroppedArray1DRef.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ template <class T> class CroppedArray1DRef final {
template <typename T2>
requires(!std::is_const_v<T2> && std::is_const_v<T> &&
std::is_same_v<std::remove_const_t<T>, std::remove_const_t<T2>>)
inline CroppedArray1DRef( // NOLINT(google-explicit-constructor)
CroppedArray1DRef( // NOLINT(google-explicit-constructor)
CroppedArray1DRef<T2> RHS)
: CroppedArray1DRef(RHS.base, RHS.offset, RHS.numElts) {}

[[nodiscard]] inline Array1DRef<T> getAsArray1DRef() const {
[[nodiscard]] Array1DRef<T> getAsArray1DRef() const {
return {begin(), size()};
}

Expand All @@ -86,8 +86,8 @@ template <class T> class CroppedArray1DRef final {

// CTAD deduction guide
template <typename T>
CroppedArray1DRef(Array1DRef<T> base, int offset, int numElts)
-> CroppedArray1DRef<T>;
CroppedArray1DRef(Array1DRef<T> base, int offset,
int numElts) -> CroppedArray1DRef<T>;

template <class T>
__attribute__((always_inline)) inline void
Expand Down
4 changes: 2 additions & 2 deletions src/librawspeed/adt/CroppedArray2DRef.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ template <class T> class CroppedArray2DRef final {

// Conversion from Array2DRef<T> to CroppedArray2DRef<T>.
// NOLINTNEXTLINE(google-explicit-constructor)
inline CroppedArray2DRef(Array2DRef<T> RHS)
CroppedArray2DRef(Array2DRef<T> RHS)
: CroppedArray2DRef(RHS, /*offsetCols=*/0, /*offsetRows=*/0, RHS.width(),
RHS.height()) {}

Expand All @@ -71,7 +71,7 @@ template <class T> class CroppedArray2DRef final {
template <class T2>
requires(!std::is_const_v<T2> && std::is_const_v<T> &&
std::is_same_v<std::remove_const_t<T>, std::remove_const_t<T2>>)
inline CroppedArray2DRef( // NOLINT(google-explicit-constructor)
CroppedArray2DRef( // NOLINT(google-explicit-constructor)
CroppedArray2DRef<T2> RHS)
: CroppedArray2DRef(RHS.base, RHS.offsetCols, RHS.offsetRows,
RHS.croppedWidth, RHS.croppedHeight) {}
Expand Down
1 change: 1 addition & 0 deletions src/librawspeed/adt/Optional.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#include "rawspeedconfig.h"
#include "adt/Invariant.h"
#include <concepts>
#include <optional> // IWYU pragma: export

namespace rawspeed {
Expand Down
14 changes: 8 additions & 6 deletions src/librawspeed/adt/PartitioningOutputIterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@

#include "adt/Bit.h"
#include <concepts>
#include <cstddef>
#include <cstdint>
#include <iterator>
#include <type_traits>

namespace rawspeed {

Expand All @@ -45,20 +48,19 @@ class PartitioningOutputIterator {

template <typename U>
requires std::same_as<UnderlyingOutputIterator, std::remove_reference_t<U>>
inline explicit PartitioningOutputIterator(U&& it_)
: it(std::forward<U>(it_)) {}
explicit PartitioningOutputIterator(U&& it_) : it(std::forward<U>(it_)) {}

[[nodiscard]] inline PartitioningOutputIterator& operator*() { return *this; }
[[nodiscard]] PartitioningOutputIterator& operator*() { return *this; }

inline PartitioningOutputIterator& operator++() { return *this; }
PartitioningOutputIterator& operator++() { return *this; }

// NOLINTNEXTLINE(cert-dcl21-cpp)
inline PartitioningOutputIterator operator++(int) { return *this; }
PartitioningOutputIterator operator++(int) { return *this; }

template <typename U>
requires(std::unsigned_integral<U> && sizeof(U) >= sizeof(PartType) &&
sizeof(U) % sizeof(PartType) == 0)
inline PartitioningOutputIterator& operator=(U coalesced) {
PartitioningOutputIterator& operator=(U coalesced) {
// NOLINTNEXTLINE(bugprone-sizeof-expression)
constexpr int NumParts = sizeof(U) / sizeof(PartType);
for (int i = 0; i != NumParts; ++i) {
Expand Down
Loading

0 comments on commit 28fd2d5

Please sign in to comment.