debug: split debug headers into components

This commit is contained in:
Danny Robson 2019-05-17 12:26:08 +10:00
parent 6bc13544dd
commit 8beada1646
90 changed files with 481 additions and 461 deletions

View File

@ -276,10 +276,18 @@ list (
cpp.hpp
cpuid.cpp
cpuid.hpp
debug.cpp
debug.hpp
debug/assert.cpp
debug/assert.hpp
debug/compiler.cpp
debug/compiler.hpp
debug/debugger.cpp
debug/debugger.hpp
debug/panic.cpp
debug/panic.hpp
debug/system.cpp
debug/system.hpp
debug/validate.cpp
debug/validate.hpp
encode/number.hpp
encode/base.cpp
encode/base.hpp

View File

@ -10,7 +10,7 @@
#ifndef CRUFT_UTIL_ALGO_SORT_HPP
#define CRUFT_UTIL_ALGO_SORT_HPP
#include "../debug.hpp"
#include "../debug/assert.hpp"
#include "../cast.hpp"
#include <iterator>

View File

@ -9,7 +9,6 @@
#pragma once
#include "../../std.hpp"
#include "../../debug.hpp"
#include "../../view.hpp"
#include <utility>

View File

@ -12,7 +12,7 @@
#include "../../cast.hpp"
#include "../../pointer.hpp"
#include "../../debug.hpp"
#include "../../debug/assert.hpp"
#include <utility>

View File

@ -11,7 +11,7 @@
#include "traits.hpp"
#include "../pointer.hpp"
#include "../debug.hpp"
#include "../debug/assert.hpp"
using cruft::alloc::linear;

View File

@ -9,10 +9,6 @@
#include "null.hpp"
#include "../debug.hpp"
#include <new>
using cruft::alloc::null;

View File

@ -8,7 +8,7 @@
#include "stack.hpp"
#include "../debug.hpp"
#include "../debug/assert.hpp"
#include "../pointer.hpp"
#include "../cast.hpp"

View File

@ -8,7 +8,7 @@
#include "parray.hpp"
#include "../debug.hpp"
#include "../debug/assert.hpp"
#include <iterator>
#include <stdexcept>

View File

@ -8,7 +8,7 @@
#pragma once
#include "../debug.hpp"
#include "../debug/assert.hpp"
#include <array>
#include <cstddef>

View File

@ -9,7 +9,7 @@
#pragma once
#include "annotation.hpp"
#include "debug.hpp"
#include "debug/assert.hpp"
#include <cstdint>
#include <stdexcept>
@ -180,7 +180,6 @@ namespace cruft::ascii {
///////////////////////////////////////////////////////////////////////////////
#include "debug.hpp"
#include <vector>
/// Converts a string of ASCII hex digits into a vector of u08 values.

View File

@ -9,7 +9,7 @@
#include "backtrace.hpp"
#include "debug.hpp"
#include "debug/assert.hpp"
#include "exe.hpp"
#include "io.hpp"
#include "cast.hpp"

View File

@ -8,7 +8,7 @@
#include "bezier.hpp"
#include "debug.hpp"
#include "debug/assert.hpp"
#include "polynomial.hpp"
#include "stream.hpp"
#include "coord/iostream.hpp"

View File

@ -9,7 +9,7 @@
#pragma once
#include "types/bits.hpp"
#include "debug.hpp"
#include "debug/assert.hpp"
#include <type_traits>
#include <cstdint>

View File

@ -8,7 +8,7 @@
#include "circular.hpp"
#include "../debug.hpp"
#include "../debug/assert.hpp"
#include "../maths.hpp"
#include "../memory/system.hpp"
#include "../posix/except.hpp"

View File

@ -8,7 +8,8 @@
#pragma once
#include "debug.hpp"
#include "debug/assert.hpp"
#include "debug/validate.hpp"
#include "platform.hpp"
#include <type_traits>

View File

@ -9,7 +9,7 @@
#include "cmdopt.hpp"
#include "cast.hpp"
#include "debug.hpp"
#include "debug/assert.hpp"
#include <cstring>
#include <iostream>

View File

@ -15,7 +15,7 @@
// we specifically rely on vector<bool> to compute a few logical operations
#include "../vector.hpp"
#include "../tuple/value.hpp"
#include "../debug.hpp"
#include "../debug/assert.hpp"
#include "../maths.hpp"
#include "../types/bits.hpp"

173
debug.cpp
View File

@ -1,173 +0,0 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Copyright 2010-2018 Danny Robson <danny@nerdcruft.net>
*/
#include "backtrace.hpp"
#include "debug.hpp"
#include "log.hpp"
#include <cruft/util/preprocessor.hpp>
#include <cstdlib>
#include <iostream>
using namespace cruft::debug;
////////////////////////////////////////////////////////////////////////////////
void
cruft::debug::detail::panic (const char *msg)
{
std::cerr << "PANIC: " << msg << "\n" << ::debug::backtrace () << std::endl;
breakpoint ();
abort ();
}
////////////////////////////////////////////////////////////////////////////////
void
cruft::debug::detail::not_implemented (const char *msg)
{
panic (msg);
}
//-----------------------------------------------------------------------------
void
cruft::debug::detail::unreachable (const char *msg)
{
panic (msg);
}
////////////////////////////////////////////////////////////////////////////////
void
warn (void)
{
warn ("Unusual code path found.");
}
//-----------------------------------------------------------------------------
void
warn (const std::string &msg)
{
warn (msg.c_str ());
}
//-----------------------------------------------------------------------------
void
warn (const char *msg)
{
LOG_WARN (msg);
}
////////////////////////////////////////////////////////////////////////////////
static void abort_with_trace (void)
{
// Manually trigger a breakpoint if possible so that the debugger won't
// silently dump us some place without further information.
// eg, CLion/GDB/Win32 silently dropping us out of the session.
breakpoint ();
// If this is because of an exception we may as well rethrow and hope that
// the system will print exception data during the abort process.
//
// But we can at least try to print anything derived from std::exception
// (which is a likely guess) before we self-destruct.
if (auto ptr = std::current_exception (); ptr) {
try {
std::rethrow_exception (ptr);
} catch (std::exception const &x) {
LOG_EMERGENCY ("unhandled exception: %!\n%!", x.what (), debug::backtrace {});
} catch (...) {
LOG_EMERGENCY ("unhandled exception: %!\n", debug::backtrace {});
}
} else {
LOG_EMERGENCY ("aborting: %!", debug::backtrace {});
}
std::abort ();
}
//-----------------------------------------------------------------------------
void
cruft::debug::init [[gnu::constructor]] (void)
{
std::set_terminate (abort_with_trace);
if (!debug_enabled && !getenv ("DEBUG"))
return;
LOG_DEBUG ("setting debug environment");
//enable_fpe ();
force_console ();
prepare_debugger ();
if (getenv ("DEBUG_WAIT"))
await_debugger ();
}
///////////////////////////////////////////////////////////////////////////////
static void
debug_wait [[gnu::constructor]] (void)
{
if (auto val = getenv ("DEBUG_WAIT")) {
LOG_NOTICE ("awaiting debugger");
if (std::string ("0") != val)
await_debugger ();
}
}
///////////////////////////////////////////////////////////////////////////////
template <>
bool
cruft::debug::validator<float>::is_valid (const float &val) noexcept
{
return !std::isnan (val);
}
//-----------------------------------------------------------------------------
template <>
bool
cruft::debug::validator<double>::is_valid (const double &val) noexcept
{
return !std::isnan (val);
}
///////////////////////////////////////////////////////////////////////////////
#include "std.hpp"
//-----------------------------------------------------------------------------
#define INSTANTIATE(KLASS) \
template <> \
struct cruft::debug::validator<KLASS> { \
static bool is_valid(KLASS const&); \
}; \
\
bool \
cruft::debug::validator<KLASS>::is_valid(KLASS const&) \
{ \
return true; \
}
//-----------------------------------------------------------------------------
MAP0(INSTANTIATE,
u08, u16, u32, u64,
i08, i16, i32, i64,
char
)

65
debug/assert.cpp Normal file
View File

@ -0,0 +1,65 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Copyright 2010-2019 Danny Robson <danny@nerdcruft.net>
*/
#include "./assert.hpp"
#include "../backtrace.hpp"
#include "../log.hpp"
#include <iostream>
////////////////////////////////////////////////////////////////////////////////
void
cruft::debug::detail::panic (const char *msg)
{
std::cerr << "PANIC: " << msg << "\n" << ::debug::backtrace () << std::endl;
breakpoint ();
abort ();
}
////////////////////////////////////////////////////////////////////////////////
void
cruft::debug::detail::not_implemented (const char *msg)
{
panic (msg);
}
//-----------------------------------------------------------------------------
void
cruft::debug::detail::unreachable (const char *msg)
{
panic (msg);
}
////////////////////////////////////////////////////////////////////////////////
void
warn (void)
{
warn ("Unusual code path found.");
}
//-----------------------------------------------------------------------------
void
warn (const std::string &msg)
{
warn (msg.c_str ());
}
//-----------------------------------------------------------------------------
void
warn (const char *msg)
{
LOG_WARN (msg);
}

View File

@ -8,17 +8,10 @@
#pragma once
#include "platform.hpp"
#include "debug/panic.hpp"
#include "../platform.hpp"
//#include "maths.hpp" // XXX: See notes at the end of file for maths.hpp inclusion
#include <cmath>
#include <algorithm>
#include <stdexcept>
#include <string>
#include <thread>
#include <iosfwd>
#include <sstream>
#include "debugger.hpp"
///////////////////////////////////////////////////////////////////////////////
@ -27,10 +20,10 @@
// macros in some scenarios. eg, templates are complicated enough without
// (more) macros.
#if !defined(NDEBUG)
constexpr bool debug_enabled = true;
constexpr bool assertions_enabled = true;
constexpr bool debug_enabled = true;
constexpr bool assertions_enabled = true;
#else
constexpr bool debug_enabled = false;
constexpr bool debug_enabled = false;
constexpr bool assertions_enabled = false;
#endif
@ -123,13 +116,15 @@
); \
_Pragma("GCC diagnostic pop") \
} while (0)
#else
#elif defined(COMPILER_CLANG)
#define CHECK(C) do { \
DEBUG_ONLY ( \
if (!(C)) \
panic (#C); \
); \
} while (0)
#else
#error Unhandled compiler
#endif
@ -320,7 +315,7 @@
#if !defined(NDEBUG)
#define CHECK_FINITE(V) do { \
#define CHECK_FINITE(V) do { \
const auto &__v = (V); \
if (!std::isfinite (__v)) { \
std::cerr << "expected finite value\n" \
@ -370,182 +365,17 @@
///////////////////////////////////////////////////////////////////////////////
/// make the compiler think a particular variable may now be aliased somewhere.
///
/// useful for preventing optimisations eliding a variable.
///
/// stolen from Chandler Carruth's 2015 talk: "Tuning C++".
namespace cruft::debug {
template <class T>
inline T*
escape (T *t)
{
asm volatile ("": : "g"(t): "memory");
return t;
}
#include <string>
#include <string_view>
template <class T>
inline const T*
escape (const T *t)
{
asm volatile ("": : "g"(t): "memory");
return t;
}
template <class T>
inline const T&
escape (const T &t)
{
return *escape (&t);
}
template <class T>
inline T&
escape (T &t)
{
return *escape (&t);
}
template <typename T, typename ...Args>
inline void
escape (T t, Args ...args)
{
escape (t);
escape (args...);
}
}
///////////////////////////////////////////////////////////////////////////////
/// force the compiler to conceptually dirty the global memory space.
///
/// stolen from Chandler Carruth's 2015 talk: "Tuning C++".
namespace cruft::debug {
inline void
clobber (void)
{
asm volatile ("": : : "memory");
}
}
void breakpoint (void);
///////////////////////////////////////////////////////////////////////////////
void warn (void);
void warn (const std::string&);
void warn (std::string const&);
void warn (std::string_view);
void warn (const char *);
///////////////////////////////////////////////////////////////////////////////
void await_debugger (void);
void prepare_debugger (void);
void force_console (void);
///////////////////////////////////////////////////////////////////////////////
void enable_fpe (void);
void disable_fpe (void);
///////////////////////////////////////////////////////////////////////////////
namespace cruft::debug {
void init (void);
///////////////////////////////////////////////////////////////////////////
// returns true if an instance of type `T' appears to be in a valid state.
//
// written as a struct rather than a function so that behaviour may be
// partially specialised. all users are free to specialise this struct
// with an user types.
//
// all specialisations must be safe to call on arbitrary data without
// exceptions or faults as this mechanism is used to control some
// debugging paths which themselves are the configuration points for
// throwing/logging/etc behaviour.
//
// ArgsT is an optional set of auxiliary values that are required to
// validate the target value.
template <typename T, typename ...ArgsT>
struct validator {
static bool is_valid (T const&, ArgsT const&...) noexcept;
};
//-------------------------------------------------------------------------
template <typename T, typename ...ArgsT>
bool is_valid (const T &t, const ArgsT &...args) noexcept
{
return validator<T,ArgsT...>::is_valid (t, args...);
}
//-------------------------------------------------------------------------
// forwarding validator from a pointer type to a reference type.
//
// null pointers are assumed to be invalid
template <typename T, typename ...ArgsT>
struct validator<T*,ArgsT...> {
static bool is_valid (const T *val, ArgsT const &...args) noexcept
{
return val && ::cruft::debug::is_valid (*val, args...);
}
};
///////////////////////////////////////////////////////////////////////////
// asserts that an instance of type `T' is in a valid state.
//
// behaviour will be controlled by NDEBUG and other assertion machinery and
// so may be optimised out entirely in optimised builds.
template <typename T>
void sanity (const T &t)
{
(void)t;
CHECK (is_valid (t));
}
//-------------------------------------------------------------------------
template <
template<typename...> class T,
typename ...Args
>
void sanity (const T<Args...> &t)
{
(void)t;
CHECK (is_valid (t));
}
template <typename ValueT>
class scoped_sanity {
public:
scoped_sanity (ValueT &_value):
m_value (_value)
{
sanity (m_value);
}
~scoped_sanity ()
{
sanity (m_value);
}
private:
const ValueT& m_value;
};
};
///////////////////////////////////////////////////////////////////////////////
// XXX: maths needs to be included so that CHECK_EQ/NEQ can call almost_equal,
// but maths.hpp might be using CHECK_ macros so we must include maths.hpp
// after we define the CHECK_ macros so the preprocessor can resolve them.
#include "maths.hpp"
#include "../maths.hpp"

9
debug/compiler.cpp Normal file
View File

@ -0,0 +1,9 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Copyright 2010-2019 Danny Robson <danny@nerdcruft.net>
*/
#include "./compiler.hpp"

62
debug/compiler.hpp Normal file
View File

@ -0,0 +1,62 @@
///////////////////////////////////////////////////////////////////////////////
/// make the compiler think a particular variable may now be aliased somewhere.
///
/// useful for preventing optimisations eliding a variable.
///
/// stolen from Chandler Carruth's 2015 talk: "Tuning C++".
namespace cruft::debug {
template <class T>
inline T*
escape (T *t)
{
asm volatile ("": : "g"(t): "memory");
return t;
}
template <class T>
inline const T*
escape (const T *t)
{
asm volatile ("": : "g"(t): "memory");
return t;
}
template <class T>
inline const T&
escape (const T &t)
{
return *escape (&t);
}
template <class T>
inline T&
escape (T &t)
{
return *escape (&t);
}
template <typename T, typename ...Args>
inline void
escape (T t, Args ...args)
{
escape (t);
escape (args...);
}
}
///////////////////////////////////////////////////////////////////////////////
/// force the compiler to conceptually dirty the global memory space.
///
/// stolen from Chandler Carruth's 2015 talk: "Tuning C++".
namespace cruft::debug {
inline void
clobber (void)
{
asm volatile ("": : : "memory");
}
}

27
debug/debugger.cpp Normal file
View File

@ -0,0 +1,27 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Copyright 2010-2019 Danny Robson <danny@nerdcruft.net>
*/
#include "./debugger.hpp"
#include "../log.hpp"
#include <string>
#include <cstdlib>
///////////////////////////////////////////////////////////////////////////////
static void
debug_wait [[gnu::constructor]] (void)
{
if (auto val = getenv ("DEBUG_WAIT")) {
LOG_NOTICE ("awaiting debugger");
if (std::string ("0") != val)
await_debugger ();
}
}

4
debug/debugger.hpp Normal file
View File

@ -0,0 +1,4 @@
void breakpoint (void);
void await_debugger (void);
void prepare_debugger (void);

64
debug/system.cpp Normal file
View File

@ -0,0 +1,64 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Copyright 2010-2019 Danny Robson <danny@nerdcruft.net>
*/
#include "./system.hpp"
#include "debugger.hpp"
#include "../backtrace.hpp"
#include "../log.hpp"
#include <cstdlib>
////////////////////////////////////////////////////////////////////////////////
static void abort_with_trace (void)
{
// Manually trigger a breakpoint if possible so that the debugger won't
// silently dump us some place without further information.
// eg, CLion/GDB/Win32 silently dropping us out of the session.
breakpoint ();
// If this is because of an exception we may as well rethrow and hope that
// the system will print exception data during the abort process.
//
// But we can at least try to print anything derived from std::exception
// (which is a likely guess) before we self-destruct.
if (auto ptr = std::current_exception (); ptr) {
try {
std::rethrow_exception (ptr);
} catch (std::exception const &x) {
LOG_EMERGENCY ("unhandled exception: %!\n%!", x.what (), debug::backtrace {});
} catch (...) {
LOG_EMERGENCY ("unhandled exception: %!\n", debug::backtrace {});
}
} else {
LOG_EMERGENCY ("aborting: %!", debug::backtrace {});
}
std::abort ();
}
///////////////////////////////////////////////////////////////////////////////
void
cruft::debug::init [[gnu::constructor]] (void)
{
std::set_terminate (abort_with_trace);
if (!debug_enabled && !getenv ("DEBUG"))
return;
LOG_DEBUG ("setting debug environment");
//enable_fpe ();
force_console ();
prepare_debugger ();
if (getenv ("DEBUG_WAIT"))
await_debugger ();
}

19
debug/system.hpp Normal file
View File

@ -0,0 +1,19 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Copyright 2010-2019 Danny Robson <danny@nerdcruft.net>
*/
#pragma once
///////////////////////////////////////////////////////////////////////////////
void enable_fpe (void);
void disable_fpe (void);
void force_console (void);
///////////////////////////////////////////////////////////////////////////////
namespace cruft::debug {
void init (void);
}

56
debug/validate.cpp Normal file
View File

@ -0,0 +1,56 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Copyright 2010-2019 Danny Robson <danny@nerdcruft.net>
*/
#include "./validate.hpp"
#include <cruft/util/preprocessor.hpp>
#include <cmath>
///////////////////////////////////////////////////////////////////////////////
template <>
bool
cruft::debug::validator<float>::is_valid (const float &val) noexcept
{
return !std::isnan (val);
}
//-----------------------------------------------------------------------------
template <>
bool
cruft::debug::validator<double>::is_valid (const double &val) noexcept
{
return !std::isnan (val);
}
///////////////////////////////////////////////////////////////////////////////
#include "std.hpp"
//-----------------------------------------------------------------------------
#define INSTANTIATE(KLASS) \
template <> \
struct cruft::debug::validator<KLASS> { \
static bool is_valid(KLASS const&); \
}; \
\
bool \
cruft::debug::validator<KLASS>::is_valid(KLASS const&) \
{ \
return true; \
}
//-----------------------------------------------------------------------------
MAP0(INSTANTIATE,
u08, u16, u32, u64,
i08, i16, i32, i64,
char
)

95
debug/validate.hpp Normal file
View File

@ -0,0 +1,95 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Copyright 2010-2019 Danny Robson <danny@nerdcruft.net>
*/
#pragma once
///////////////////////////////////////////////////////////////////////////////
namespace cruft::debug {
///////////////////////////////////////////////////////////////////////////
// returns true if an instance of type `T' appears to be in a valid state.
//
// written as a struct rather than a function so that behaviour may be
// partially specialised. all users are free to specialise this struct
// with an user types.
//
// all specialisations must be safe to call on arbitrary data without
// exceptions or faults as this mechanism is used to control some
// debugging paths which themselves are the configuration points for
// throwing/logging/etc behaviour.
//
// ArgsT is an optional set of auxiliary values that are required to
// validate the target value.
template <typename T, typename ...ArgsT>
struct validator {
static bool is_valid (T const&, ArgsT const&...) noexcept;
};
//-------------------------------------------------------------------------
template <typename T, typename ...ArgsT>
bool is_valid (const T &t, const ArgsT &...args) noexcept
{
return validator<T,ArgsT...>::is_valid (t, args...);
}
//-------------------------------------------------------------------------
// forwarding validator from a pointer type to a reference type.
//
// null pointers are assumed to be invalid
template <typename T, typename ...ArgsT>
struct validator<T*,ArgsT...> {
static bool is_valid (const T *val, ArgsT const &...args) noexcept
{
return val && ::cruft::debug::is_valid (*val, args...);
}
};
///////////////////////////////////////////////////////////////////////////
// asserts that an instance of type `T' is in a valid state.
//
// behaviour will be controlled by NDEBUG and other assertion machinery and
// so may be optimised out entirely in optimised builds.
template <typename T>
void sanity (const T &t)
{
(void)t;
CHECK (is_valid (t));
}
//-------------------------------------------------------------------------
template <
template<typename...> class T,
typename ...Args
>
void sanity (const T<Args...> &t)
{
(void)t;
CHECK (is_valid (t));
}
template <typename ValueT>
class scoped_sanity {
public:
scoped_sanity (ValueT &_value):
m_value (_value)
{
sanity (m_value);
}
~scoped_sanity ()
{
sanity (m_value);
}
private:
const ValueT& m_value;
};
};

View File

@ -7,7 +7,8 @@
* 2011-2016, Danny Robson <danny@nerdcruft.net>
*/
#include "debug.hpp"
#include "debug/debugger.hpp"
#include "debug/system.hpp"
#include "log.hpp"
#include "platform.hpp"

View File

@ -11,8 +11,6 @@
#include "../view.hpp"
#include "../debug.hpp"
#include <cstdint>
#include <array>

View File

@ -8,7 +8,6 @@
#include "extent.hpp"
#include "debug.hpp"
#include "maths.hpp"
#include <algorithm>

View File

@ -7,7 +7,7 @@
*/
#include "float.hpp"
#include "debug.hpp"
#include "debug/assert.hpp"
#include <cmath>

View File

@ -11,7 +11,6 @@
#include "iostream.hpp"
#include "../coord/iostream.hpp"
#include "../debug.hpp"
using cruft::geom::aabb;

View File

@ -8,7 +8,7 @@
#pragma once
#include "../debug.hpp"
#include "../debug/assert.hpp"
#include "../extent.hpp"
#include "../point.hpp"

View File

@ -9,8 +9,6 @@
#include "plane.hpp"
#include "../debug.hpp"
using cruft::geom::plane;

View File

@ -11,7 +11,6 @@
#include "iostream.hpp"
#include "ops.hpp"
#include "../coord/iostream.hpp"
#include "../debug.hpp"
using cruft::geom::ray;

View File

@ -9,7 +9,6 @@
#include "crc.hpp"
#include "../bitwise.hpp"
#include "../debug.hpp"
#include <array>

View File

@ -9,7 +9,6 @@
#include "fasthash.hpp"
#include "../endian.hpp"
#include "../debug.hpp"
using cruft::hash::fasthash;

View File

@ -9,9 +9,6 @@
#include "fletcher.hpp"
#include "../debug.hpp"
using cruft::hash::fletcher;

View File

@ -8,7 +8,7 @@
#include "common.hpp"
#include "../../debug.hpp"
#include "../../debug/panic.hpp"
///////////////////////////////////////////////////////////////////////////////

View File

@ -9,7 +9,6 @@
#include "murmur1.hpp"
#include "common.hpp"
#include "../../debug.hpp"
#include "../../endian.hpp"
using cruft::hash::murmur1;

View File

@ -9,7 +9,6 @@
#include "murmur2.hpp"
#include "../../debug.hpp"
#include "common.hpp"
using cruft::hash::murmur2;

View File

@ -9,7 +9,7 @@
#include "siphash.hpp"
#include "../bitwise.hpp"
#include "../debug.hpp"
#include "../debug/assert.hpp"
#include "../endian.hpp"
using cruft::hash::siphash;

View File

@ -9,7 +9,7 @@
#include "xxhash.hpp"
#include "../bitwise.hpp"
#include "../debug.hpp"
#include "../debug/assert.hpp"
#include "../endian.hpp"
#include <cstring>

2
io.cpp
View File

@ -8,7 +8,7 @@
#include "io.hpp"
#include "debug.hpp"
#include "debug/assert.hpp"
#include "cast.hpp"
#include "format.hpp"
#include "posix/except.hpp"

View File

@ -9,7 +9,6 @@
#include "io.hpp"
#include "cast.hpp"
#include "debug.hpp"
#include "except.hpp"
#include "posix/fd.hpp"
#include "posix/except.hpp"

View File

@ -8,7 +8,7 @@
#pragma once
#include "debug.hpp"
#include "debug/assert.hpp"
#include "iterator/zip.hpp"
#include "point.hpp"

View File

@ -9,7 +9,6 @@
#include "log.hpp"
#include "debug.hpp"
#include "term.hpp"
#include "time.hpp"
#include "cast.hpp"

View File

@ -8,7 +8,7 @@
#pragma once
#include "../debug.hpp"
#include "../debug/assert.hpp"
#include <array>
#include <utility>

View File

@ -10,7 +10,7 @@
#define CRUFT_UTIL_MATHS_FAST_HPP
#include "../maths.hpp"
#include "../debug.hpp"
#include "../debug/assert.hpp"
namespace cruft::maths::fast {
float

View File

@ -8,7 +8,7 @@
#include "matrix.hpp"
#include "debug.hpp"
#include "debug/assert.hpp"
#include "iterator/infix.hpp"
#include "point.hpp"

View File

@ -8,7 +8,8 @@
#include "point.hpp"
#include "debug.hpp"
#include "debug/assert.hpp"
#include "debug/validate.hpp"
#include "std.hpp"
#include <cstdlib>

View File

@ -6,11 +6,10 @@
* Copyright 2011-2016 Danny Robson <danny@nerdcruft.net>
*/
#ifndef CRUFT_UTIL_POOL_HPP
#define CRUFT_UTIL_POOL_HPP
#pragma once
#include "nocopy.hpp"
#include "debug.hpp"
#include "debug/assert.hpp"
#include "cast.hpp"
#include <atomic>
@ -168,5 +167,3 @@ namespace cruft {
const T& operator[] (size_t idx) const&;
};
}
#endif

View File

@ -9,7 +9,6 @@
#pragma once
#include "except.hpp"
#include "../debug.hpp"
#include <cerrno>
#include <dirent.h>

View File

@ -10,7 +10,7 @@
#include "except.hpp"
#include "../platform.hpp"
#include "../debug.hpp"
#include "../debug/assert.hpp"
#include <cstring>

View File

@ -6,10 +6,8 @@
* Copyright 2017-2018 Danny Robson <danny@nerdcruft.net>
*/
#ifndef CRUFT_UTIL_POSIX_FD_HPP
#define CRUFT_UTIL_POSIX_FD_HPP
#pragma once
#include "../debug.hpp"
#include "../view.hpp"
#include <filesystem>
@ -83,6 +81,3 @@ namespace cruft::posix {
int m_fd;
};
}
#endif

View File

@ -9,7 +9,7 @@
#include "quaternion.hpp"
#include "debug.hpp"
#include "debug/assert.hpp"
#include "vector.hpp"
#include "coord/ops.hpp"

View File

@ -9,7 +9,7 @@
#include "mwc64x.hpp"
#include "../debug.hpp"
#include "../debug/assert.hpp"
using cruft::rand::mwc64x;

View File

@ -8,7 +8,7 @@
#include "xorshift.hpp"
#include "../debug.hpp"
#include "../debug/assert.hpp"
#include <cstdint>

View File

@ -9,7 +9,7 @@
#include "range.hpp"
#include "debug.hpp"
#include "debug/assert.hpp"
#include "maths.hpp"
#include "random.hpp"

View File

@ -9,7 +9,7 @@
#include "rational.hpp"
#include "maths.hpp"
#include "debug.hpp"
#include "debug/assert.hpp"
#include <cstdint>

View File

@ -9,7 +9,7 @@
#include "region.hpp"
#include "debug.hpp"
#include "debug/assert.hpp"
#include "coord/iostream.hpp"

View File

@ -9,7 +9,7 @@
#pragma once
#include "types/traits.hpp"
#include "debug.hpp"
#include "debug/assert.hpp"
#include "nocopy.hpp"
#include <algorithm>

View File

@ -6,10 +6,9 @@
* Copyright 2018 Danny Robson <danny@nerdcruft.net>
*/
#ifndef CRUFT_UTIL_SINGLETON_HPP
#define CRUFT_UTIL_SINGLETON_HPP
#pragma once
#include "debug.hpp"
#include "debug/assert.hpp"
#include <memory>
@ -81,5 +80,3 @@ namespace cruft {
template <typename SelfT>
SelfT*
cruft::singleton<SelfT>::instance;
#endif

View File

@ -8,7 +8,7 @@
#include "stream.hpp"
#include "debug.hpp"
#include "debug/assert.hpp"
#include <ostream>

View File

@ -8,8 +8,6 @@
#include "string.hpp"
#include "./debug.hpp"
#include <cstring>
#include <codecvt>
#include <locale>

View File

@ -9,7 +9,7 @@
#pragma once
#include "ascii.hpp"
#include "debug.hpp"
#include "debug/assert.hpp"
#include "view.hpp"
#include <string>

View File

@ -7,7 +7,7 @@
*/
#include "tap.hpp"
#include "debug.hpp"
#include "debug/assert.hpp"
#include <iostream>

View File

@ -8,7 +8,6 @@
#pragma once
#include "debug.hpp"
#include "except.hpp"
#include "format.hpp"
#include "maths.hpp"

View File

@ -1,7 +1,7 @@
#include "tap.hpp"
#include "array/sarray.hpp"
#include "debug.hpp"
#include "debug/assert.hpp"
#include <vector>

View File

@ -1,7 +1,7 @@
#include "std.hpp"
#include "tap.hpp"
#include "buffer/paged.hpp"
#include "debug.hpp"
#include "debug/assert.hpp"
#include "except.hpp"
#include "posix/except.hpp"

View File

@ -1,6 +1,5 @@
#include "cmdopt.hpp"
#include "debug.hpp"
#include "tap.hpp"
#include "types.hpp"
#include "maths.hpp"

View File

@ -1,6 +1,5 @@
#include "float.hpp"
#include "debug.hpp"
#include "tap.hpp"
#include "types.hpp"

View File

@ -4,7 +4,6 @@
#include "types.hpp"
#include "tap.hpp"
#include "debug.hpp"
#include <cstdlib>
#include <cstring>

View File

@ -1,6 +1,5 @@
#include "maths.hpp"
#include "debug.hpp"
#include "tap.hpp"
#include <cstdlib>

View File

@ -1,6 +1,5 @@
#include "matrix.hpp"
#include "debug.hpp"
#include "tap.hpp"
#include "vector.hpp"
#include "coord/iostream.hpp"

View File

@ -1,7 +1,6 @@
#include "parallel/queue.hpp"
#include "thread/flag.hpp"
#include "thread/semaphore.hpp"
#include "debug.hpp"
#include "tap.hpp"
#include <algorithm>

View File

@ -1,6 +1,6 @@
#include "point.hpp"
#include "debug.hpp"
#include "debug/assert.hpp"
#include "tap.hpp"
#include "types.hpp"
#include "coord/iostream.hpp"

View File

@ -1,7 +1,6 @@
#include "polynomial.hpp"
#include "float.hpp"
#include "debug.hpp"
#include "tap.hpp"
#include "types.hpp"

View File

@ -1,6 +1,5 @@
#include "stringid.hpp"
#include "debug.hpp"
#include "tap.hpp"
#include <cstdlib>

View File

@ -1,6 +1,5 @@
#include "uri.hpp"
#include "debug.hpp"
#include "tap.hpp"
int

View File

@ -10,7 +10,7 @@
#include "primitive.hpp"
#include "../debug.hpp"
#include "../debug/assert.hpp"
using cruft::thread::spinlock;

View File

@ -8,7 +8,7 @@
#include "time/parse.hpp"
#include "debug.hpp"
#include "debug/assert.hpp"
#include "posix/except.hpp"
#include <stdexcept>

View File

@ -8,7 +8,7 @@
#include "description.hpp"
#include "../debug.hpp"
#include "../debug/assert.hpp"
///////////////////////////////////////////////////////////////////////////////

View File

@ -8,8 +8,6 @@
#include "uri.hpp"
#include "debug.hpp"
#include <algorithm>
#include <iostream>

View File

@ -6,11 +6,10 @@
* Copyright 2015, 2017 Danny Robson <danny@nerdcruft.net>
*/
#ifndef CRUFT_UTIL_URI_HPP
#define CRUFT_UTIL_URI_HPP
#include "debug.hpp"
#include "debug/assert.hpp"
#include "view.hpp"
#include <array>

View File

@ -8,7 +8,7 @@
#include "vector.hpp"
#include "debug.hpp"
#include "debug/assert.hpp"
#include "std.hpp"
#include <cmath>

View File

@ -13,7 +13,7 @@
#include "coord/ops.hpp"
#include "coord.hpp"
#include "debug.hpp"
#include "debug/assert.hpp"
#include "maths.hpp"
#include <cstddef>

View File

@ -12,7 +12,7 @@
#include <cstring>
#include <stdexcept>
#include "debug.hpp"
#include "debug/assert.hpp"
// We generate some really old style C code via ragel here, so we have to
// disable some noisy warnings (doubly so given -Werror)

View File

@ -10,7 +10,7 @@
#include "annotation.hpp"
#include "cast.hpp"
#include "debug.hpp"
#include "debug/assert.hpp"
#include "maths.hpp"
#include "platform.hpp"
#include "types/traits.hpp"