aboutsummaryrefslogtreecommitdiff
path: root/thirdparty/raw_pdb/src/Foundation
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2026-04-23 18:16:57 +0200
committerStefan Boberg <[email protected]>2026-04-23 18:16:57 +0200
commit0232b991cd7d8e3a2114ea30e4591dd3e7b65c36 (patch)
tree94730e7594fd09ae1fa820391ce311f6daf13905 /thirdparty/raw_pdb/src/Foundation
parentFix forward declaration order for s_GotSigWinch and SigWinchHandler (diff)
parenttrace: declare Region event name fields as AnsiString (#1012) (diff)
downloadarchived-zen-sb/zen-help.tar.xz
archived-zen-sb/zen-help.zip
Merge branch 'main' into sb/zen-helpsb/zen-help
- Combine HelpCommand (this branch) with HistoryCommand (main) in zen CLI dispatcher - Keep filter-aware TuiPickOne rewrite; adopt main's ASCII arrow glyphs in doc comment
Diffstat (limited to 'thirdparty/raw_pdb/src/Foundation')
-rw-r--r--thirdparty/raw_pdb/src/Foundation/PDB_ArrayView.h68
-rw-r--r--thirdparty/raw_pdb/src/Foundation/PDB_Assert.h27
-rw-r--r--thirdparty/raw_pdb/src/Foundation/PDB_BitOperators.h23
-rw-r--r--thirdparty/raw_pdb/src/Foundation/PDB_BitUtil.h73
-rw-r--r--thirdparty/raw_pdb/src/Foundation/PDB_CRT.h14
-rw-r--r--thirdparty/raw_pdb/src/Foundation/PDB_Forward.h9
-rw-r--r--thirdparty/raw_pdb/src/Foundation/PDB_Log.h15
-rw-r--r--thirdparty/raw_pdb/src/Foundation/PDB_Macros.h126
-rw-r--r--thirdparty/raw_pdb/src/Foundation/PDB_Memory.h11
-rw-r--r--thirdparty/raw_pdb/src/Foundation/PDB_Move.h11
-rw-r--r--thirdparty/raw_pdb/src/Foundation/PDB_Platform.h45
-rw-r--r--thirdparty/raw_pdb/src/Foundation/PDB_PointerUtil.h33
-rw-r--r--thirdparty/raw_pdb/src/Foundation/PDB_TypeTraits.h65
-rw-r--r--thirdparty/raw_pdb/src/Foundation/PDB_Warnings.h45
14 files changed, 565 insertions, 0 deletions
diff --git a/thirdparty/raw_pdb/src/Foundation/PDB_ArrayView.h b/thirdparty/raw_pdb/src/Foundation/PDB_ArrayView.h
new file mode 100644
index 000000000..3c462ee80
--- /dev/null
+++ b/thirdparty/raw_pdb/src/Foundation/PDB_ArrayView.h
@@ -0,0 +1,68 @@
+// Copyright 2011-2022, Molecular Matters GmbH <[email protected]>
+// See LICENSE.txt for licensing details (2-clause BSD License: https://opensource.org/licenses/BSD-2-Clause)
+
+#pragma once
+
+#include "PDB_Macros.h"
+#include "PDB_Assert.h"
+
+
+namespace PDB
+{
+ // A read-only view into arrays of any type and length.
+ template <typename T>
+ class PDB_NO_DISCARD ArrayView
+ {
+ public:
+ // Constructs an array view from a C array with explicit length.
+ inline constexpr explicit ArrayView(const T* const array, size_t length) PDB_NO_EXCEPT
+ : m_data(array)
+ , m_length(length)
+ {
+ }
+
+ PDB_DEFAULT_COPY_CONSTRUCTOR(ArrayView);
+ PDB_DEFAULT_MOVE_CONSTRUCTOR(ArrayView);
+
+ // Provides read-only access to the underlying array.
+ PDB_NO_DISCARD inline constexpr const T* Decay(void) const PDB_NO_EXCEPT
+ {
+ return m_data;
+ }
+
+ // Returns the length of the view.
+ PDB_NO_DISCARD inline constexpr size_t GetLength(void) const PDB_NO_EXCEPT
+ {
+ return m_length;
+ }
+
+ // Returns the i-th element.
+ PDB_NO_DISCARD inline const T& operator[](size_t i) const PDB_NO_EXCEPT
+ {
+ PDB_ASSERT(i < GetLength(), "Index %zu out of bounds [0, %zu).", i, GetLength());
+ return m_data[i];
+ }
+
+
+ // ------------------------------------------------------------------------------------------------
+ // Range-based for-loop support
+ // ------------------------------------------------------------------------------------------------
+
+ PDB_NO_DISCARD inline const T* begin(void) const PDB_NO_EXCEPT
+ {
+ return m_data;
+ }
+
+ PDB_NO_DISCARD inline const T* end(void) const PDB_NO_EXCEPT
+ {
+ return m_data + m_length;
+ }
+
+ private:
+ const T* const m_data;
+ const size_t m_length;
+
+ PDB_DISABLE_MOVE_ASSIGNMENT(ArrayView);
+ PDB_DISABLE_COPY_ASSIGNMENT(ArrayView);
+ };
+}
diff --git a/thirdparty/raw_pdb/src/Foundation/PDB_Assert.h b/thirdparty/raw_pdb/src/Foundation/PDB_Assert.h
new file mode 100644
index 000000000..6991e063e
--- /dev/null
+++ b/thirdparty/raw_pdb/src/Foundation/PDB_Assert.h
@@ -0,0 +1,27 @@
+// Copyright 2011-2022, Molecular Matters GmbH <[email protected]>
+// See LICENSE.txt for licensing details (2-clause BSD License: https://opensource.org/licenses/BSD-2-Clause)
+
+#pragma once
+
+#include "PDB_Macros.h"
+#include "PDB_Log.h"
+
+
+PDB_PUSH_WARNING_CLANG
+PDB_DISABLE_WARNING_CLANG("-Wgnu-zero-variadic-macro-arguments")
+PDB_DISABLE_WARNING_CLANG("-Wreserved-identifier")
+
+extern "C" void __cdecl __debugbreak(void);
+
+#if PDB_COMPILER_MSVC
+# pragma intrinsic(__debugbreak)
+#endif
+
+
+#ifdef _DEBUG
+# define PDB_ASSERT(_condition, _msg, ...) (_condition) ? (void)true : (PDB_LOG_ERROR(_msg, ##__VA_ARGS__), __debugbreak())
+#else
+# define PDB_ASSERT(_condition, _msg, ...) PDB_NOOP(_condition, _msg, ##__VA_ARGS__)
+#endif
+
+PDB_POP_WARNING_CLANG
diff --git a/thirdparty/raw_pdb/src/Foundation/PDB_BitOperators.h b/thirdparty/raw_pdb/src/Foundation/PDB_BitOperators.h
new file mode 100644
index 000000000..04f17a44b
--- /dev/null
+++ b/thirdparty/raw_pdb/src/Foundation/PDB_BitOperators.h
@@ -0,0 +1,23 @@
+// Copyright 2011-2022, Molecular Matters GmbH <[email protected]>
+// See LICENSE.txt for licensing details (2-clause BSD License: https://opensource.org/licenses/BSD-2-Clause)
+
+#pragma once
+
+#include "PDB_Macros.h"
+
+
+#define PDB_DEFINE_BIT_OPERATORS(_type) \
+ PDB_NO_DISCARD inline constexpr _type operator|(_type lhs, _type rhs) PDB_NO_EXCEPT \
+ { \
+ return static_cast<_type>(PDB_AS_UNDERLYING(lhs) | PDB_AS_UNDERLYING(rhs)); \
+ } \
+ \
+ PDB_NO_DISCARD inline constexpr _type operator&(_type lhs, _type rhs) PDB_NO_EXCEPT \
+ { \
+ return static_cast<_type>(PDB_AS_UNDERLYING(lhs) & PDB_AS_UNDERLYING(rhs)); \
+ } \
+ \
+ PDB_NO_DISCARD inline constexpr _type operator~(_type value) PDB_NO_EXCEPT \
+ { \
+ return static_cast<_type>(~PDB_AS_UNDERLYING(value)); \
+ }
diff --git a/thirdparty/raw_pdb/src/Foundation/PDB_BitUtil.h b/thirdparty/raw_pdb/src/Foundation/PDB_BitUtil.h
new file mode 100644
index 000000000..7dc5ee3e9
--- /dev/null
+++ b/thirdparty/raw_pdb/src/Foundation/PDB_BitUtil.h
@@ -0,0 +1,73 @@
+// Copyright 2011-2022, Molecular Matters GmbH <[email protected]>
+// See LICENSE.txt for licensing details (2-clause BSD License: https://opensource.org/licenses/BSD-2-Clause)
+
+#pragma once
+
+#include "PDB_Assert.h"
+
+#ifdef _WIN32
+ PDB_PUSH_WARNING_CLANG
+ PDB_DISABLE_WARNING_CLANG("-Wreserved-identifier")
+
+ extern "C" unsigned char _BitScanForward(unsigned long* _Index, unsigned long _Mask);
+
+ PDB_POP_WARNING_CLANG
+
+# if PDB_COMPILER_MSVC
+# pragma intrinsic(_BitScanForward)
+# endif
+#endif
+
+
+namespace PDB
+{
+ namespace BitUtil
+ {
+ // Returns whether the given unsigned value is a power of two.
+ template <typename T>
+ PDB_NO_DISCARD inline constexpr bool IsPowerOfTwo(T value) PDB_NO_EXCEPT
+ {
+ PDB_ASSERT(value != 0u, "Invalid value.");
+
+ return (value & (value - 1u)) == 0u;
+ }
+
+
+ // Rounds the given unsigned value up to the next multiple.
+ template <typename T>
+ PDB_NO_DISCARD inline constexpr T RoundUpToMultiple(T numToRound, T multipleOf) PDB_NO_EXCEPT
+ {
+ PDB_ASSERT(IsPowerOfTwo(multipleOf), "Multiple must be a power-of-two.");
+
+ return (numToRound + (multipleOf - 1u)) & ~(multipleOf - 1u);
+ }
+
+
+ // Finds the position of the first set bit in the given value starting from the LSB, e.g. FindFirstSetBit(0b00000010) == 1.
+ // This operation is also known as CTZ (Count Trailing Zeros).
+ template <typename T>
+ PDB_NO_DISCARD inline uint32_t FindFirstSetBit(T value) PDB_NO_EXCEPT;
+
+ template <>
+ PDB_NO_DISCARD inline uint32_t FindFirstSetBit(uint32_t value) PDB_NO_EXCEPT
+ {
+ PDB_ASSERT(value != 0u, "Invalid value.");
+
+#ifdef _WIN32
+ unsigned long result = 0ul;
+
+ _BitScanForward(&result, value);
+#else
+ unsigned int result = 0u;
+
+ result = static_cast<unsigned int>(__builtin_ffs(static_cast<int>(value)));
+ if (result)
+ {
+ --result;
+ }
+#endif
+
+ return result;
+ }
+ }
+}
diff --git a/thirdparty/raw_pdb/src/Foundation/PDB_CRT.h b/thirdparty/raw_pdb/src/Foundation/PDB_CRT.h
new file mode 100644
index 000000000..539dab33e
--- /dev/null
+++ b/thirdparty/raw_pdb/src/Foundation/PDB_CRT.h
@@ -0,0 +1,14 @@
+// Copyright 2011-2022, Molecular Matters GmbH <[email protected]>
+// See LICENSE.txt for licensing details (2-clause BSD License: https://opensource.org/licenses/BSD-2-Clause)
+
+#pragma once
+
+
+// avoid pulling in different headers just for a few declarations
+extern "C" int __cdecl printf(char const* const _Format, ...);
+
+extern "C" int __cdecl memcmp(void const* _Buf1, void const* _Buf2, size_t _Size);
+extern "C" void* __cdecl memcpy(void* _Dst, void const* _Src, size_t _Size);
+
+extern "C" size_t __cdecl strlen(char const* _Str);
+extern "C" int __cdecl strcmp(char const* _Str1, char const* _Str2);
diff --git a/thirdparty/raw_pdb/src/Foundation/PDB_Forward.h b/thirdparty/raw_pdb/src/Foundation/PDB_Forward.h
new file mode 100644
index 000000000..ba82dfee0
--- /dev/null
+++ b/thirdparty/raw_pdb/src/Foundation/PDB_Forward.h
@@ -0,0 +1,9 @@
+// Copyright 2011-2022, Molecular Matters GmbH <[email protected]>
+// See LICENSE.txt for licensing details (2-clause BSD License: https://opensource.org/licenses/BSD-2-Clause)
+
+#pragma once
+
+
+// See Jonathan Mueller's blog for replacing std::move and std::forward:
+// https://foonathan.net/2021/09/move-forward/
+#define PDB_FORWARD(...) static_cast<decltype(__VA_ARGS__)&&>(__VA_ARGS__)
diff --git a/thirdparty/raw_pdb/src/Foundation/PDB_Log.h b/thirdparty/raw_pdb/src/Foundation/PDB_Log.h
new file mode 100644
index 000000000..83a8518ea
--- /dev/null
+++ b/thirdparty/raw_pdb/src/Foundation/PDB_Log.h
@@ -0,0 +1,15 @@
+// Copyright 2011-2022, Molecular Matters GmbH <[email protected]>
+// See LICENSE.txt for licensing details (2-clause BSD License: https://opensource.org/licenses/BSD-2-Clause)
+
+#pragma once
+
+#include "PDB_Macros.h"
+#include "PDB_CRT.h"
+
+
+PDB_PUSH_WARNING_CLANG
+PDB_DISABLE_WARNING_CLANG("-Wgnu-zero-variadic-macro-arguments")
+
+#define PDB_LOG_ERROR(_format, ...) printf(_format, ##__VA_ARGS__)
+
+PDB_POP_WARNING_CLANG
diff --git a/thirdparty/raw_pdb/src/Foundation/PDB_Macros.h b/thirdparty/raw_pdb/src/Foundation/PDB_Macros.h
new file mode 100644
index 000000000..fddcccfa4
--- /dev/null
+++ b/thirdparty/raw_pdb/src/Foundation/PDB_Macros.h
@@ -0,0 +1,126 @@
+// Copyright 2011-2022, Molecular Matters GmbH <[email protected]>
+// See LICENSE.txt for licensing details (2-clause BSD License: https://opensource.org/licenses/BSD-2-Clause)
+
+#pragma once
+
+#include "PDB_Platform.h"
+#include "PDB_TypeTraits.h"
+
+
+// ------------------------------------------------------------------------------------------------
+// ATTRIBUTES
+// ------------------------------------------------------------------------------------------------
+
+// Indicates to the compiler that the return value of a function or class should not be ignored.
+#if PDB_CPP_17
+# define PDB_NO_DISCARD [[nodiscard]]
+#else
+# define PDB_NO_DISCARD
+#endif
+
+// Indicates to the compiler that a function does not throw an exception.
+#define PDB_NO_EXCEPT noexcept
+
+
+// ------------------------------------------------------------------------------------------------
+// SPECIAL MEMBER FUNCTIONS
+// ------------------------------------------------------------------------------------------------
+
+// Default special member functions.
+#define PDB_DEFAULT_COPY_CONSTRUCTOR(_name) _name(const _name&) PDB_NO_EXCEPT = default
+#define PDB_DEFAULT_COPY_ASSIGNMENT(_name) _name& operator=(const _name&) PDB_NO_EXCEPT = default
+#define PDB_DEFAULT_MOVE_CONSTRUCTOR(_name) _name(_name&&) PDB_NO_EXCEPT = default
+#define PDB_DEFAULT_MOVE_ASSIGNMENT(_name) _name& operator=(_name&&) PDB_NO_EXCEPT = default
+
+// Default copy member functions.
+#define PDB_DEFAULT_COPY(_name) PDB_DEFAULT_COPY_CONSTRUCTOR(_name); PDB_DEFAULT_COPY_ASSIGNMENT(_name)
+
+// Default move member functions.
+#define PDB_DEFAULT_MOVE(_name) PDB_DEFAULT_MOVE_CONSTRUCTOR(_name); PDB_DEFAULT_MOVE_ASSIGNMENT(_name)
+
+// Single macro to default all copy and move member functions.
+#define PDB_DEFAULT_COPY_MOVE(_name) PDB_DEFAULT_COPY(_name); PDB_DEFAULT_MOVE(_name)
+
+// Disable special member functions.
+#define PDB_DISABLE_COPY_CONSTRUCTOR(_name) _name(const _name&) PDB_NO_EXCEPT = delete
+#define PDB_DISABLE_COPY_ASSIGNMENT(_name) _name& operator=(const _name&) PDB_NO_EXCEPT = delete
+#define PDB_DISABLE_MOVE_CONSTRUCTOR(_name) _name(_name&&) PDB_NO_EXCEPT = delete
+#define PDB_DISABLE_MOVE_ASSIGNMENT(_name) _name& operator=(_name&&) PDB_NO_EXCEPT = delete
+
+// Disable copy member functions.
+#define PDB_DISABLE_COPY(_name) PDB_DISABLE_COPY_CONSTRUCTOR(_name); PDB_DISABLE_COPY_ASSIGNMENT(_name)
+
+// Disable move member functions.
+#define PDB_DISABLE_MOVE(_name) PDB_DISABLE_MOVE_CONSTRUCTOR(_name); PDB_DISABLE_MOVE_ASSIGNMENT(_name)
+
+// Single macro to disable all copy and move member functions.
+#define PDB_DISABLE_COPY_MOVE(_name) PDB_DISABLE_COPY(_name); PDB_DISABLE_MOVE(_name)
+
+
+// ------------------------------------------------------------------------------------------------
+// COMPILER WARNINGS
+// ------------------------------------------------------------------------------------------------
+
+#if PDB_COMPILER_MSVC
+# define PDB_PRAGMA(_x) __pragma(_x)
+
+# define PDB_PUSH_WARNING_MSVC PDB_PRAGMA(warning(push))
+# define PDB_SUPPRESS_WARNING_MSVC(_number) PDB_PRAGMA(warning(suppress : _number))
+# define PDB_DISABLE_WARNING_MSVC(_number) PDB_PRAGMA(warning(disable : _number))
+# define PDB_POP_WARNING_MSVC PDB_PRAGMA(warning(pop))
+
+# define PDB_PUSH_WARNING_CLANG
+# define PDB_DISABLE_WARNING_CLANG(_diagnostic)
+# define PDB_POP_WARNING_CLANG
+#elif PDB_COMPILER_CLANG
+# define PDB_PRAGMA(_x) _Pragma(#_x)
+
+# define PDB_PUSH_WARNING_MSVC
+# define PDB_SUPPRESS_WARNING_MSVC(_number)
+# define PDB_DISABLE_WARNING_MSVC(_number)
+# define PDB_POP_WARNING_MSVC
+
+# define PDB_PUSH_WARNING_CLANG PDB_PRAGMA(clang diagnostic push)
+# define PDB_DISABLE_WARNING_CLANG(_diagnostic) PDB_PRAGMA(clang diagnostic ignored _diagnostic)
+# define PDB_POP_WARNING_CLANG PDB_PRAGMA(clang diagnostic pop)
+#elif PDB_COMPILER_GCC
+# define PDB_PRAGMA(_x) _Pragma(#_x)
+
+# define PDB_PUSH_WARNING_MSVC
+# define PDB_SUPPRESS_WARNING_MSVC(_number)
+# define PDB_DISABLE_WARNING_MSVC(_number)
+# define PDB_POP_WARNING_MSVC
+
+# define PDB_PUSH_WARNING_CLANG
+# define PDB_DISABLE_WARNING_CLANG(_diagnostic)
+# define PDB_POP_WARNING_CLANG
+#endif
+
+
+// ------------------------------------------------------------------------------------------------
+// MISCELLANEOUS
+// ------------------------------------------------------------------------------------------------
+
+// Trick to make other macros require a semicolon at the end.
+#define PDB_REQUIRE_SEMICOLON static_assert(true, "")
+
+// Defines a C-like flexible array member.
+#define PDB_FLEXIBLE_ARRAY_MEMBER(_type, _name) \
+ PDB_PUSH_WARNING_MSVC \
+ PDB_PUSH_WARNING_CLANG \
+ PDB_DISABLE_WARNING_MSVC(4200) \
+ PDB_DISABLE_WARNING_CLANG("-Wzero-length-array") \
+ _type _name[0]; \
+ PDB_POP_WARNING_MSVC \
+ PDB_POP_WARNING_CLANG \
+ PDB_REQUIRE_SEMICOLON
+
+// Casts any value to the value of the underlying type.
+#define PDB_AS_UNDERLYING(_value) static_cast<typename PDB::underlying_type<decltype(_value)>::type>(_value)
+
+// Signals to the compiler that a function should be ignored, but have its argument list parsed (and "used", so as to not generate "unused variable" warnings).
+#if PDB_COMPILER_MSVC
+# define PDB_NOOP __noop
+#else
+# define PDB_NOOP(...) (void)sizeof(__VA_ARGS__)
+#endif
diff --git a/thirdparty/raw_pdb/src/Foundation/PDB_Memory.h b/thirdparty/raw_pdb/src/Foundation/PDB_Memory.h
new file mode 100644
index 000000000..ccb7e8698
--- /dev/null
+++ b/thirdparty/raw_pdb/src/Foundation/PDB_Memory.h
@@ -0,0 +1,11 @@
+// Copyright 2011-2022, Molecular Matters GmbH <[email protected]>
+// See LICENSE.txt for licensing details (2-clause BSD License: https://opensource.org/licenses/BSD-2-Clause)
+
+#pragma once
+
+
+#define PDB_NEW(_type) new _type
+#define PDB_NEW_ARRAY(_type, _length) new _type[_length]
+
+#define PDB_DELETE(_ptr) delete _ptr
+#define PDB_DELETE_ARRAY(_ptr) delete[] _ptr
diff --git a/thirdparty/raw_pdb/src/Foundation/PDB_Move.h b/thirdparty/raw_pdb/src/Foundation/PDB_Move.h
new file mode 100644
index 000000000..04bf78b0b
--- /dev/null
+++ b/thirdparty/raw_pdb/src/Foundation/PDB_Move.h
@@ -0,0 +1,11 @@
+// Copyright 2011-2022, Molecular Matters GmbH <[email protected]>
+// See LICENSE.txt for licensing details (2-clause BSD License: https://opensource.org/licenses/BSD-2-Clause)
+
+#pragma once
+
+#include "PDB_TypeTraits.h"
+
+
+// See Jonathan Mueller's blog for replacing std::move and std::forward:
+// https://foonathan.net/2020/09/move-forward/
+#define PDB_MOVE(...) static_cast<PDB::remove_reference<decltype(__VA_ARGS__)>::type&&>(__VA_ARGS__)
diff --git a/thirdparty/raw_pdb/src/Foundation/PDB_Platform.h b/thirdparty/raw_pdb/src/Foundation/PDB_Platform.h
new file mode 100644
index 000000000..8775a548c
--- /dev/null
+++ b/thirdparty/raw_pdb/src/Foundation/PDB_Platform.h
@@ -0,0 +1,45 @@
+// Copyright 2011-2022, Molecular Matters GmbH <[email protected]>
+// See LICENSE.txt for licensing details (2-clause BSD License: https://opensource.org/licenses/BSD-2-Clause)
+
+#pragma once
+
+
+// determine the compiler/toolchain used
+#if defined(__clang__)
+# define PDB_COMPILER_MSVC 0
+# define PDB_COMPILER_CLANG 1
+# define PDB_COMPILER_GCC 0
+#elif defined(_MSC_VER)
+# define PDB_COMPILER_MSVC 1
+# define PDB_COMPILER_CLANG 0
+# define PDB_COMPILER_GCC 0
+#elif defined(__GNUC__)
+# define PDB_COMPILER_MSVC 0
+# define PDB_COMPILER_CLANG 0
+# define PDB_COMPILER_GCC 1
+#else
+# error("Unknown compiler.");
+#endif
+
+// check whether C++17 is available
+#if __cplusplus >= 201703L
+# define PDB_CPP_17 1
+#else
+# define PDB_CPP_17 0
+#endif
+
+// define used standard types
+typedef decltype(sizeof(0)) size_t;
+static_assert(sizeof(sizeof(0)) == sizeof(size_t), "Wrong size.");
+
+typedef int int32_t;
+static_assert(sizeof(int32_t) == 4u, "Wrong size.");
+
+typedef unsigned char uint8_t;
+static_assert(sizeof(uint8_t) == 1u, "Wrong size.");
+
+typedef unsigned short uint16_t;
+static_assert(sizeof(uint16_t) == 2u, "Wrong size.");
+
+typedef unsigned int uint32_t;
+static_assert(sizeof(uint32_t) == 4u, "Wrong size.");
diff --git a/thirdparty/raw_pdb/src/Foundation/PDB_PointerUtil.h b/thirdparty/raw_pdb/src/Foundation/PDB_PointerUtil.h
new file mode 100644
index 000000000..014297df0
--- /dev/null
+++ b/thirdparty/raw_pdb/src/Foundation/PDB_PointerUtil.h
@@ -0,0 +1,33 @@
+// Copyright 2011-2022, Molecular Matters GmbH <[email protected]>
+// See LICENSE.txt for licensing details (2-clause BSD License: https://opensource.org/licenses/BSD-2-Clause)
+
+#pragma once
+
+#include "PDB_Macros.h"
+#include "PDB_TypeTraits.h"
+
+
+namespace PDB
+{
+ namespace Pointer
+ {
+ // Offsets any pointer by a given number of bytes.
+ template <typename T, typename U, typename V>
+ PDB_NO_DISCARD inline T Offset(U* anyPointer, V howManyBytes) PDB_NO_EXCEPT
+ {
+ static_assert(PDB::is_pointer<T>::value == true, "Type T must be a pointer type.");
+
+ union
+ {
+ T as_T;
+ U* as_U_ptr;
+ char* as_char_ptr;
+ };
+
+ as_U_ptr = anyPointer;
+ as_char_ptr += howManyBytes;
+
+ return as_T;
+ }
+ }
+}
diff --git a/thirdparty/raw_pdb/src/Foundation/PDB_TypeTraits.h b/thirdparty/raw_pdb/src/Foundation/PDB_TypeTraits.h
new file mode 100644
index 000000000..928645394
--- /dev/null
+++ b/thirdparty/raw_pdb/src/Foundation/PDB_TypeTraits.h
@@ -0,0 +1,65 @@
+// Copyright 2011-2022, Molecular Matters GmbH <[email protected]>
+// See LICENSE.txt for licensing details (2-clause BSD License: https://opensource.org/licenses/BSD-2-Clause)
+
+#pragma once
+
+
+// provide our own type traits to avoid pulling in unnecessary includes
+namespace PDB
+{
+ template <class T>
+ struct is_pointer
+ {
+ static constexpr bool value = false;
+ };
+
+ template <class T>
+ struct is_pointer<T*>
+ {
+ static constexpr bool value = true;
+ };
+
+ template <class T>
+ struct is_pointer<T* const>
+ {
+ static constexpr bool value = true;
+ };
+
+ template <class T>
+ struct is_pointer<T* volatile>
+ {
+ static constexpr bool value = true;
+ };
+
+ template <class T>
+ struct is_pointer<T* const volatile>
+ {
+ static constexpr bool value = true;
+ };
+
+
+ template <class T>
+ struct remove_reference
+ {
+ using type = T;
+ };
+
+ template <class T>
+ struct remove_reference<T&>
+ {
+ using type = T;
+ };
+
+ template <class T>
+ struct remove_reference<T&&>
+ {
+ using type = T;
+ };
+
+
+ template <class T>
+ struct underlying_type
+ {
+ using type = __underlying_type(T);
+ };
+}
diff --git a/thirdparty/raw_pdb/src/Foundation/PDB_Warnings.h b/thirdparty/raw_pdb/src/Foundation/PDB_Warnings.h
new file mode 100644
index 000000000..fbc8a9de2
--- /dev/null
+++ b/thirdparty/raw_pdb/src/Foundation/PDB_Warnings.h
@@ -0,0 +1,45 @@
+// Copyright 2011-2022, Molecular Matters GmbH <[email protected]>
+// See LICENSE.txt for licensing details (2-clause BSD License: https://opensource.org/licenses/BSD-2-Clause)
+
+#pragma once
+
+#include "PDB_Platform.h"
+
+#if PDB_COMPILER_MSVC
+ // some warnings were introduced with different versions of Visual Studio, so we disable this warning instead of using a bunch of #if/#endif
+# pragma warning (disable : 4619) // there is no warning number N
+
+ // we compile with exceptions disabled
+# pragma warning (disable : 4530) // C++ exception handler used, but unwind semantics are not enabled.Specify / EHsc
+# pragma warning (disable : 4577) // 'noexcept' used with no exception handling mode specified; termination on exception is not guaranteed. Specify /EHsc
+
+ // ignore purely informational warnings
+# pragma warning (disable : 4514) // unreferenced inline function has been removed
+# pragma warning (disable : 4710) // function not inlined
+# pragma warning (disable : 4711) // function selected for automatic inline expansion
+# pragma warning (disable : 4820) // 'N' bytes padding added after data member 'm_member'
+# pragma warning (disable : 5045) // Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified
+#elif PDB_COMPILER_CLANG
+ // turn on absolutely all available Clang warnings
+# pragma clang diagnostic warning "-Wall"
+# pragma clang diagnostic warning "-Wextra"
+# pragma clang diagnostic warning "-Weverything"
+# pragma clang diagnostic warning "-Wpedantic"
+
+ // these warnings contradict -Weverything
+# pragma clang diagnostic ignored "-Wc++98-compat"
+# pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
+
+ // this warning is triggered for templates which are explicitly instantiated.
+ // forgetting to instantiate the template would trigger a linker error anyway, so we disable this warning.
+# pragma clang diagnostic ignored "-Wundefined-func-template"
+
+ // we don't strive for C++20 compatibility
+# pragma clang diagnostic ignored "-Wc++20-compat"
+
+ // some structures will have to be padded
+# pragma clang diagnostic ignored "-Wpadded"
+
+ // it's impossible to write C++ code using raw pointers without triggering this warning
+# pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
+#endif