summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.txt8
-rw-r--r--CMakeLists.txt2
-rw-r--r--dux/CMakeLists.txt2
-rw-r--r--dux/include/dux/base.h7
-rw-r--r--dux/include/dux/cxx/base.hh42
-rw-r--r--dux/include/dux/cxx/math.hh26
-rw-r--r--dux/src/abrt.cc2
-rw-r--r--dux/src/exit.cc2
-rw-r--r--dux/src/onexit.cc2
9 files changed, 51 insertions, 42 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 2ac6f1e..28cd085 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,3 +1,11 @@
+| 27
+
+- Correct comment in "/dux/src/exit.cc";
+- Add project description to CMake;
+- Remove initialisation for the lock in dux.abrt as it's deprecated in C++20;
+- Fix return type not being specified in the C-implementation for dux.onexit;
+- Fix ld complaining about multiple definitions of compile-time objects when the project is compiled with Clang;
+
| 26
- Rewrite and restructure project;
diff --git a/CMakeLists.txt b/CMakeLists.txt
index afad967..5ee4e15 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,7 +11,7 @@ project(
# Constants:
set(
DUX_VERSION
- 30.0
+ 31.0
)
# Subdirectories
diff --git a/dux/CMakeLists.txt b/dux/CMakeLists.txt
index 9e8544b..f5531b7 100644
--- a/dux/CMakeLists.txt
+++ b/dux/CMakeLists.txt
@@ -30,6 +30,8 @@ project(
ASM # CMake recommends placing assembly as the last entry in the list of languages.
VERSION
${DUX_VERSION}
+ DESCRIPTION
+ "General purpose library."
)
# Target:
diff --git a/dux/include/dux/base.h b/dux/include/dux/base.h
index b31f976..5c1ac31 100644
--- a/dux/include/dux/base.h
+++ b/dux/include/dux/base.h
@@ -48,7 +48,6 @@
# error Header must be included from C or C++!
# endif
-
# if defined(dux_lang_c)
# include <stdbool.h> /* We really want the bool macros. We can't define them ourselves, as that would be UB (note: read next line), as we may not declare nor define anything the standard library defines. */
# undef false /* NOT UB: cppreference: "A program may undefine and perhaps then redefine the macros bool, true and false." (cppreference) */
@@ -67,7 +66,7 @@
# endif
# endif
-# define dux_priv_ver 0x1E
+# define dux_priv_ver 0x1F
# if !defined(dux_dbg)
# if defined(_DEBUG) || !defined(NDEBUG)
@@ -220,8 +219,8 @@
# endif
# if defined(dux_lang_c)
-# define dux_nullptr ((void *)0x0)
-# define dux_priv_nullptr dux_nullptr
+# define dux_priv_nullptr ((void *)0x0)
+# define dux_nullptr dux_priv_nullptr
# elif defined(dux_lang_cxx)
# define dux_priv_nullptr nullptr
# endif
diff --git a/dux/include/dux/cxx/base.hh b/dux/include/dux/cxx/base.hh
index bbf2176..6f2554f 100644
--- a/dux/include/dux/cxx/base.hh
+++ b/dux/include/dux/cxx/base.hh
@@ -37,27 +37,27 @@ namespace dux {
using nullptrtyp = decltype (nullptr);
}
-namespace dux { /* Clang (13.0.1) complains about multiple definitions here. Clang is retarded. */
- template<typename T> constexpr auto maxval {T {0x0}};
- template<> constexpr auto maxval<bool> {static_cast<bool>( true)};
- template<> constexpr auto maxval<char> {static_cast<char>( dux_chrmax)};
- template<> constexpr auto maxval<char16_t> {static_cast<char16_t>( dux_chr16max)};
- template<> constexpr auto maxval<char32_t> {static_cast<char32_t>( dux_chr32max)};
- template<> constexpr auto maxval<char8_t> {static_cast<char8_t>( dux_chr8max)};
- template<> constexpr auto maxval<double> {static_cast<double>( dux_dblmax)};
- template<> constexpr auto maxval<int> {static_cast<int>( dux_intmax)};
- template<> constexpr auto maxval<long> {static_cast<long>( dux_lngmax)};
- template<> constexpr auto maxval<long double> {static_cast<long double>( dux_ldblmax)};
- template<> constexpr auto maxval<long long> {static_cast<long long>( dux_llngmax)};
- template<> constexpr auto maxval<::dux::nullptrtyp> { nullptr};
- template<> constexpr auto maxval<short> {static_cast<short>( dux_shrtmax)};
- template<> constexpr auto maxval<signed char> {static_cast<signed char>( dux_schrmax)};
- template<> constexpr auto maxval<unsigned char> {static_cast<unsigned char>( dux_uchrmax)};
- template<> constexpr auto maxval<unsigned int> {static_cast<unsigned int>( dux_uintmax)};
- template<> constexpr auto maxval<unsigned long> {static_cast<unsigned long>( dux_ulngmax)};
- template<> constexpr auto maxval<unsigned long long> {static_cast<unsigned long long>(dux_ullngmax)};
- template<> constexpr auto maxval<unsigned short> {static_cast<unsigned short>( dux_ushrtmax)};
- template<> constexpr auto maxval<wchar_t> {static_cast<wchar_t>( dux_wchrmax)};
+namespace dux { /* Clang may not be retarted. */
+ template<typename T> constexpr auto static maxval {T {0x0}};
+ template<> constexpr auto static maxval<bool> {static_cast<bool>( true)};
+ template<> constexpr auto static maxval<char> {static_cast<char>( dux_chrmax)};
+ template<> constexpr auto static maxval<char16_t> {static_cast<char16_t>( dux_chr16max)};
+ template<> constexpr auto static maxval<char32_t> {static_cast<char32_t>( dux_chr32max)};
+ template<> constexpr auto static maxval<char8_t> {static_cast<char8_t>( dux_chr8max)};
+ template<> constexpr auto static maxval<double> {static_cast<double>( dux_dblmax)};
+ template<> constexpr auto static maxval<int> {static_cast<int>( dux_intmax)};
+ template<> constexpr auto static maxval<long> {static_cast<long>( dux_lngmax)};
+ template<> constexpr auto static maxval<long double> {static_cast<long double>( dux_ldblmax)};
+ template<> constexpr auto static maxval<long long> {static_cast<long long>( dux_llngmax)};
+ template<> constexpr auto static maxval<::dux::nullptrtyp> { nullptr};
+ template<> constexpr auto static maxval<short> {static_cast<short>( dux_shrtmax)};
+ template<> constexpr auto static maxval<signed char> {static_cast<signed char>( dux_schrmax)};
+ template<> constexpr auto static maxval<unsigned char> {static_cast<unsigned char>( dux_uchrmax)};
+ template<> constexpr auto static maxval<unsigned int> {static_cast<unsigned int>( dux_uintmax)};
+ template<> constexpr auto static maxval<unsigned long> {static_cast<unsigned long>( dux_ulngmax)};
+ template<> constexpr auto static maxval<unsigned long long> {static_cast<unsigned long long>(dux_ullngmax)};
+ template<> constexpr auto static maxval<unsigned short> {static_cast<unsigned short>( dux_ushrtmax)};
+ template<> constexpr auto static maxval<wchar_t> {static_cast<wchar_t>( dux_wchrmax)};
}
namespace dux::priv {
diff --git a/dux/include/dux/cxx/math.hh b/dux/include/dux/cxx/math.hh
index a0b885b..89fb670 100644
--- a/dux/include/dux/cxx/math.hh
+++ b/dux/include/dux/cxx/math.hh
@@ -18,29 +18,29 @@
*/
namespace dux::num {
- constexpr auto e {dux_priv_num_e};
- constexpr auto phi {dux_priv_num_phi};
- constexpr auto pi {dux_priv_num_pi};
+ constexpr static auto e {dux_priv_num_e};
+ constexpr static auto phi {dux_priv_num_phi};
+ constexpr static auto pi {dux_priv_num_pi};
}
namespace dux::priv {
- template<::dux::arithtyp T> constexpr auto inf {::dux::maxval<T>};
- template<> constexpr auto inf<double> {dux_priv_infd};
- template<> constexpr auto inf<float> {dux_priv_inff};
- template<> constexpr auto inf<long double> {dux_priv_infld};
+ template<::dux::arithtyp T> constexpr static auto inf {::dux::maxval<T>};
+ template<> constexpr static auto inf<double> {dux_priv_infd};
+ template<> constexpr static auto inf<float> {dux_priv_inff};
+ template<> constexpr static auto inf<long double> {dux_priv_infld};
}
namespace dux {
- template<::dux::arithtyp T> constexpr auto inf {::dux::priv::inf<T>};
+ template<::dux::arithtyp T> constexpr static auto inf {::dux::priv::inf<T>};
}
namespace dux::priv {
- template<::dux::arithtyp T> constexpr auto nan {T {0x0}};
- template<> constexpr auto nan<double> {dux_priv_nand};
- template<> constexpr auto nan<float> {dux_priv_nanf};
- template<> constexpr auto nan<long double> {dux_priv_nanld};
+ template<::dux::arithtyp T> constexpr static auto nan {T {0x0}};
+ template<> constexpr static auto nan<double> {dux_priv_nand};
+ template<> constexpr static auto nan<float> {dux_priv_nanf};
+ template<> constexpr static auto nan<long double> {dux_priv_nanld};
}
namespace dux {
- template<::dux::arithtyp T> constexpr auto nan {::dux::priv::nan<T>};
+ template<::dux::arithtyp T> constexpr static auto nan {::dux::priv::nan<T>};
}
namespace dux {
diff --git a/dux/src/abrt.cc b/dux/src/abrt.cc
index 36a9b4b..07712e6 100644
--- a/dux/src/abrt.cc
+++ b/dux/src/abrt.cc
@@ -24,7 +24,7 @@
# include <dux/thrd>
auto ::dux::abrt() noexcept -> void {
- static ::std::atomic_flag lock {ATOMIC_FLAG_INIT};
+ static ::std::atomic_flag lock;
while (lock.test_and_set()) {} /* We make sure we don't abort from multiple threads. */
::dux::dbglog("dux :: abrt :: Aborting!\n");
if (::dux::haserr()) {::dux::dbglog("dux :: abrt :: Last error: %s\n",::dux::errcdnm(::dux::geterr()));}
diff --git a/dux/src/exit.cc b/dux/src/exit.cc
index 9e3bd74..785316a 100644
--- a/dux/src/exit.cc
+++ b/dux/src/exit.cc
@@ -28,7 +28,7 @@
auto ::dux::exit(::dux::stat const _stat) noexcept -> void {
# if defined(dux_os_linux)
- if (::dux_priv_posix_getpid() != static_cast<::pid_t>(::dux::syscall(__NR_gettid))) [[unlikely]] { /* Check if calling thread is also the main thread. Only thread exit is allowed outside the main thread. */
+ if (::dux_priv_posix_getpid() != static_cast<::pid_t>(::dux::syscall(__NR_gettid))) [[unlikely]] { /* Check if calling thread is also the main thread. Only thread exit and quick exit are allowed outside the main thread. */
::dux::dbglog("dux :: \x1B[91mexit\x1B[0m :: Standard exit invoked outside main thread!\n");
::dux::abrt();
}
diff --git a/dux/src/onexit.cc b/dux/src/onexit.cc
index 93c24af..e42261a 100644
--- a/dux/src/onexit.cc
+++ b/dux/src/onexit.cc
@@ -52,4 +52,4 @@ ret:;
# pragma GCC diagnostic ignored "-Wmissing-declarations"
-extern "C" dux_attr_cold auto dux_onexit(::dux::priv::onexitfn const _fn) {::dux::onexit(_fn);}
+extern "C" dux_attr_cold auto dux_onexit(::dux::priv::onexitfn const _fn) -> void {::dux::onexit(_fn);}