Skip to content

Commit

Permalink
Nest microfmt in the libassert namespace due to conditionally-enabled…
Browse files Browse the repository at this point in the history
… C++17 behavior causing ODR issues, solves #103
  • Loading branch information
jeremy-rifkin committed Sep 13, 2024
1 parent 53bfad1 commit ac8bc8e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/microfmt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// https://github.com/jeremy-rifkin/microfmt
// Format: {[align][width][:[fill][base]]} # width: number or {}

namespace microfmt {
namespace libassert::microfmt {
namespace detail {
inline std::uint64_t clz(std::uint64_t value) {
#ifdef _MSC_VER
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/assertion_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ std::string prepare(std::string_view string, location loc) {
auto message = replace(
join(lines, "\n"),
"<LOCATION>",
microfmt::format("{}:{}: {}", loc.file, loc.line, loc.signature)
libassert::microfmt::format("{}:{}: {}", loc.file, loc.line, loc.signature)
);
return message;
}
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/literals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,16 @@ int main() {
static std::regex int_hex = std::regex("^0[Xx](?!')(?:'?[\\da-fA-F])+" + optional_integer_suffix + "$");

static std::string digit_sequence = "\\d(?:'?\\d)*";
static std::string fractional_constant = microfmt::format("(?:(?:{})?\\.{}|{}\\.)", digit_sequence, digit_sequence, digit_sequence);
static std::string fractional_constant = libassert::microfmt::format("(?:(?:{})?\\.{}|{}\\.)", digit_sequence, digit_sequence, digit_sequence);
static std::string exponent_part = "(?:[Ee][\\+-]?" + digit_sequence + ")";
static std::string suffix = "[FfLl]";
static std::regex float_decimal = std::regex(microfmt::format("^(?:{}{}?|{}{}){}?$",
static std::regex float_decimal = std::regex(libassert::microfmt::format("^(?:{}{}?|{}{}){}?$",
fractional_constant, exponent_part,
digit_sequence, exponent_part, suffix));
static std::string hex_digit_sequence = "[\\da-fA-F](?:'?[\\da-fA-F])*";
static std::string hex_frac_const = microfmt::format("(?:(?:{})?\\.{}|{}\\.)", hex_digit_sequence, hex_digit_sequence, hex_digit_sequence);
static std::string hex_frac_const = libassert::microfmt::format("(?:(?:{})?\\.{}|{}\\.)", hex_digit_sequence, hex_digit_sequence, hex_digit_sequence);
static std::string binary_exp = "[Pp][\\+-]?" + digit_sequence;
static std::regex float_hex = std::regex(microfmt::format("^0[Xx](?:{}|{}){}{}?$",
static std::regex float_hex = std::regex(libassert::microfmt::format("^0[Xx](?:{}|{}){}{}?$",
hex_frac_const, hex_digit_sequence, binary_exp, suffix));
let matches_any = [&](const std::string& str) {
let matches = [](const std::string& value, const std::regex& re) {
Expand Down

0 comments on commit ac8bc8e

Please sign in to comment.