Adds pedantic-error flag, work on making source more aligned with ISO C++
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2022-04-01 12:05:48 +02:00
parent 510fa60c0e
commit 219fbfc94e
6 changed files with 37 additions and 35 deletions

View File

@@ -5,7 +5,7 @@
std::string ExceptionHandler::_ArbutilsLastException = "";
/// @brief Returns a null-terminated C string to the last exception found.
export const char* Arbutils_C_GetLastException() { return ExceptionHandler::GetLastException(); }
export_func const char* Arbutils_C_GetLastException() { return ExceptionHandler::GetLastException(); }
#if !WINDOWS && SIGNAL_HANDLING
static ArbUt::SignalHandling sh;
@@ -13,5 +13,5 @@ static ArbUt::SignalHandling sh;
export void Arbutils_C_SetSignalCallback(void (*callback)(const char*)) { sh.SetCallback(callback); }
#else
/// @brief Sets a callback to a function to run when a signal occurs.
export void Arbutils_C_SetSignalCallback(void (*)(const char*)) { }
export_func void Arbutils_C_SetSignalCallback(void (*)(const char*)) { }
#endif

View File

@@ -4,7 +4,7 @@
#include <exception>
#include <string>
#include "../src/Exception.hpp"
#define export extern "C" [[maybe_unused]]
#define export_func extern "C" [[maybe_unused]]
#define ArbutilsException 3;

View File

@@ -4,35 +4,35 @@
/// @file
/// @brief Constructs a random class.
export ArbUt::Random* Arbutils_Random_Construct() { return new ArbUt::Random(); }
export_func ArbUt::Random* Arbutils_Random_Construct() { return new ArbUt::Random(); }
/// @brief Constructs a random class with a specific seed.
export ArbUt::Random* Arbutils_Random_ConstructWithSeed(uint_fast32_t seed) { return new ArbUt::Random(seed); }
export_func ArbUt::Random* Arbutils_Random_ConstructWithSeed(uint_fast32_t seed) { return new ArbUt::Random(seed); }
/// @brief Call the destructor on a random object.
export void Arbutils_Random_Destruct(ArbUt::Random* p) { delete p; }
export_func void Arbutils_Random_Destruct(ArbUt::Random* p) { delete p; }
/// @brief Returns a random float between 0.0 and 1.0 using a random object.
export float Arbutils_Random_GetFloat(ArbUt::Random* p) { return p->GetFloat(); }
export_func float Arbutils_Random_GetFloat(ArbUt::Random* p) { return p->GetFloat(); }
/// @brief Returns a random double between 0.0 and 1.0 using a random object.
export double Arbutils_Random_GetDouble(ArbUt::Random* p) { return p->GetDouble(); }
export_func double Arbutils_Random_GetDouble(ArbUt::Random* p) { return p->GetDouble(); }
/// @brief Returns a random a random 32 bit integer using a random object.
export i32 Arbutils_Random_Get(ArbUt::Random* p) { return p->Get(); }
export_func i32 Arbutils_Random_Get(ArbUt::Random* p) { return p->Get(); }
/// @brief Gets a random 32 bit integer with a given max. Returns a status code where 0 is Ok, and passes the output to the out parameter.
export u8 Arbutils_Random_GetWithMax(ArbUt::Random* p, i32 max, i32& out) { Try(out = p->Get(max);) }
export_func u8 Arbutils_Random_GetWithMax(ArbUt::Random* p, i32 max, i32& out) { Try(out = p->Get(max);) }
/// @brief Gets a random 32 bit integer with a given min and max. Returns a status code where 0 is Ok, and passes the output to the out parameter.
export u8 Arbutils_Random_GetInLimits(ArbUt::Random* p, i32 min, i32 max, i32& out) {
export_func u8 Arbutils_Random_GetInLimits(ArbUt::Random* p, i32 min, i32 max, i32& out) {
Try(out = p->Get(min, max);)
}
/// @brief Returns a random a random 32 bit unsigned integer using a random object.
export u32 Arbutils_Random_GetUnsigned(ArbUt::Random* p) { return p->GetUnsigned(); }
export_func u32 Arbutils_Random_GetUnsigned(ArbUt::Random* p) { return p->GetUnsigned(); }
/// @brief Gets a random 32 bit unsigned integer with a given max. Returns a status code where 0 is Ok, and passes the output to the out parameter.
export u8 Arbutils_Random_GetUnsignedWithMax(ArbUt::Random* p, u32 max, u32& out) {
export_func u8 Arbutils_Random_GetUnsignedWithMax(ArbUt::Random* p, u32 max, u32& out) {
Try(out = p->GetUnsigned(max);)
}
/// @brief Gets a random 32 bit unsigned integer with a given min and max. Returns a status code where 0 is Ok, and passes the output to the out parameter.
export u8 Arbutils_Random_GetUnsignedInLimits(ArbUt::Random* p, u32 min, u32 max, u32& out) {
export_func u8 Arbutils_Random_GetUnsignedInLimits(ArbUt::Random* p, u32 min, u32 max, u32& out) {
Try(out = p->GetUnsigned(min, max);)
}
/// @brief Returns the seed of the random object.
export uint_fast32_t Arbutils_Random_GetSeed(ArbUt::Random* p) { return p->GetSeed(); }
export_func uint_fast32_t Arbutils_Random_GetSeed(ArbUt::Random* p) { return p->GetSeed(); }