From 4747b649fd3c59fb0048b81c35932fe700b50f61 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Tue, 20 Apr 2021 12:10:53 +1000 Subject: [PATCH] build: address clang-tidy errors --- encode/base.cpp | 1 - encode/base.hpp | 7 +++---- expected.hpp | 9 +++++++-- job/queue.hpp | 4 ++-- maths/fast.hpp | 13 +++++-------- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/encode/base.cpp b/encode/base.cpp index bd327002..3f4bddc6 100644 --- a/encode/base.cpp +++ b/encode/base.cpp @@ -7,4 +7,3 @@ */ #include "base.hpp" - diff --git a/encode/base.hpp b/encode/base.hpp index ad8627a5..d41b14bf 100644 --- a/encode/base.hpp +++ b/encode/base.hpp @@ -6,8 +6,7 @@ * Copyright 2017 Danny Robson */ -#ifndef CRUFT_UTIL_BASE64_HPP -#define CRUFT_UTIL_BASE64_HPP +#pragma once #include "../view.hpp" @@ -94,6 +93,8 @@ namespace cruft::encode { '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', }; + + //------------------------------------------------------------------------- template <> const uint8_t alphabet<16>::dec[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -241,5 +242,3 @@ namespace cruft::encode { } }; }; - -#endif diff --git a/expected.hpp b/expected.hpp index 113c4a45..a9aa99de 100644 --- a/expected.hpp +++ b/expected.hpp @@ -52,9 +52,14 @@ namespace cruft { using error_type = ErrorT; expected () = delete; - expected (expected &&rhs) - { + expected (expected &&rhs) noexcept ( + std::is_nothrow_destructible_v && + std::is_nothrow_destructible_v && + std::is_nothrow_move_constructible_v && + std::is_nothrow_move_constructible_v + ) { destroy (); + if (rhs) { m_valid = true; ::new (&m_store.value) ValueT (std::move (rhs.value ())); diff --git a/job/queue.hpp b/job/queue.hpp index dfca8bb1..8a1b3162 100644 --- a/job/queue.hpp +++ b/job/queue.hpp @@ -66,13 +66,13 @@ namespace cruft::job { { ; } - cookie (cookie &&rhs): + cookie (cookie &&rhs) noexcept: data (nullptr) { std::swap (data, rhs.data); } - cookie& operator= (cookie &&rhs) + cookie& operator= (cookie &&rhs) noexcept { std::swap (data, rhs.data); return *this; diff --git a/maths/fast.hpp b/maths/fast.hpp index 4ef86b99..f726f072 100644 --- a/maths/fast.hpp +++ b/maths/fast.hpp @@ -6,14 +6,13 @@ * Copyright 2018 Danny Robson */ -#ifndef CRUFT_UTIL_MATHS_FAST_HPP -#define CRUFT_UTIL_MATHS_FAST_HPP +#pragma once #include "../maths.hpp" #include "../debug/assert.hpp" namespace cruft::maths::fast { - float + constexpr float estrin (float t, float a, float b, float c, float d) { const auto t2 = t * t; @@ -34,7 +33,7 @@ namespace cruft::maths::fast { // // using minimax(sin(x)-x, [|3,5,7,9|], ...) has higher accuracy, but // probably not enough to offset the extra multiplications. - float + constexpr float sin (float x) noexcept { CHECK_LT (x, 2 * pi); @@ -84,7 +83,7 @@ namespace cruft::maths::fast { // P; // dirtyinfnorm(P(x)-exp(x), [0;1]); // plot(P(x)-exp(x),[0; 1]); - float + constexpr float exp (float x) { union { @@ -108,6 +107,4 @@ namespace cruft::maths::fast { return frac * whole.f; } -} - -#endif +} \ No newline at end of file