Defend against min and max macros from windows.h (#105)
Alternative to https://github.com/microsoft/vcpkg/pull/37512/files#diff-9f533b43a5faabaa6b5a0e046f0ae425cd85736808604dd61dc9a955db3d060aR9 I left the examples in mach-o.hpp as they are guarded by #if IS_APPLE
This commit is contained in:
parent
2985cb1d6c
commit
37e6cef4f9
@ -118,7 +118,7 @@ namespace cpptrace {
|
||||
return *this;
|
||||
}
|
||||
bool has_value() const noexcept {
|
||||
return raw_value != std::numeric_limits<T>::max();
|
||||
return raw_value != (std::numeric_limits<T>::max)();
|
||||
}
|
||||
T& value() noexcept {
|
||||
return raw_value;
|
||||
@ -133,7 +133,7 @@ namespace cpptrace {
|
||||
std::swap(raw_value, other.raw_value);
|
||||
}
|
||||
void reset() noexcept {
|
||||
raw_value = std::numeric_limits<T>::max();
|
||||
raw_value = (std::numeric_limits<T>::max)();
|
||||
}
|
||||
bool operator==(const nullable& other) const noexcept {
|
||||
return raw_value == other.raw_value;
|
||||
@ -142,7 +142,7 @@ namespace cpptrace {
|
||||
return raw_value != other.raw_value;
|
||||
}
|
||||
constexpr static nullable null() noexcept {
|
||||
return { std::numeric_limits<T>::max() };
|
||||
return { (std::numeric_limits<T>::max)() };
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -343,7 +343,7 @@ namespace libdwarf {
|
||||
return;
|
||||
}
|
||||
Dwarf_Addr baseaddr = 0;
|
||||
if(lowpc != std::numeric_limits<Dwarf_Addr>::max()) {
|
||||
if(lowpc != (std::numeric_limits<Dwarf_Addr>::max)()) {
|
||||
baseaddr = lowpc;
|
||||
}
|
||||
Dwarf_Ranges* ranges = nullptr;
|
||||
@ -381,7 +381,7 @@ namespace libdwarf {
|
||||
template<typename F>
|
||||
// callback should return true to keep going
|
||||
void dwarf_ranges(int version, optional<Dwarf_Addr> pc, F callback) const {
|
||||
Dwarf_Addr lowpc = std::numeric_limits<Dwarf_Addr>::max();
|
||||
Dwarf_Addr lowpc = (std::numeric_limits<Dwarf_Addr>::max)();
|
||||
if(wrap(dwarf_lowpc, die, &lowpc) == DW_DLV_OK) {
|
||||
if(pc.has_value() && pc.unwrap() == lowpc) {
|
||||
callback(lowpc, lowpc + 1);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user