mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
Merge bitcoin/bitcoin#23335: refactor: include a missing <limits> header in fs.cpp
077a875d94b51e3c87381133657be98989c8643e refactor: include a missing <limits> header in fs.cpp (Joan Karadimov) Pull request description: I get this compilation error on versions `0.21.1` and `22.0`: ``` fs.cpp: In member function 'bool fsbridge::FileLock::TryLock()': fs.cpp:123:89: error: 'numeric_limits' is not a member of 'std' 123 | if (!LockFileEx(hFile, LOCKFILE_EXCLUSIVE_LOCK | LOCKFILE_FAIL_IMMEDIATELY, 0, std::numeric_limits<DWORD>::max(), std::numeric_limits<DWORD>::max(), &overlapped)) { | ^~~~~~~~~~~~~~ fs.cpp:123:109: error: expected primary-expression before '>' token 123 | if (!LockFileEx(hFile, LOCKFILE_EXCLUSIVE_LOCK | LOCKFILE_FAIL_IMMEDIATELY, 0, std::numeric_limits<DWORD>::max(), std::numeric_limits<DWORD>::max(), &overlapped)) { | ^ fs.cpp:123:112: error: '::max' has not been declared; did you mean 'std::max'? 123 | if (!LockFileEx(hFile, LOCKFILE_EXCLUSIVE_LOCK | LOCKFILE_FAIL_IMMEDIATELY, 0, std::numeric_limits<DWORD>::max(), std::numeric_limits<DWORD>::max(), &overlapped)) { | ^~~ | std::max In file included from C:/dev/msys64/mingw64/include/c++/11.2.0/bits/char_traits.h:39, from C:/dev/msys64/mingw64/include/c++/11.2.0/string:40, from ./fs.h:9, from fs.cpp:5: C:/dev/msys64/mingw64/include/c++/11.2.0/bits/stl_algobase.h:300:5: note: 'std::max' declared here 300 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ fs.cpp:123:124: error: 'numeric_limits' is not a member of 'std' 123 | if (!LockFileEx(hFile, LOCKFILE_EXCLUSIVE_LOCK | LOCKFILE_FAIL_IMMEDIATELY, 0, std::numeric_limits<DWORD>::max(), std::numeric_limits<DWORD>::max(), &overlapped)) { | ^~~~~~~~~~~~~~ fs.cpp:123:144: error: expected primary-expression before '>' token 123 | if (!LockFileEx(hFile, LOCKFILE_EXCLUSIVE_LOCK | LOCKFILE_FAIL_IMMEDIATELY, 0, std::numeric_limits<DWORD>::max(), std::numeric_limits<DWORD>::max(), &overlapped)) { | ^ fs.cpp:123:147: error: '::max' has not been declared; did you mean 'std::max'? 123 | if (!LockFileEx(hFile, LOCKFILE_EXCLUSIVE_LOCK | LOCKFILE_FAIL_IMMEDIATELY, 0, std::numeric_limits<DWORD>::max(), std::numeric_limits<DWORD>::max(), &overlapped)) { | ^~~ | std::max In file included from C:/dev/msys64/mingw64/include/c++/11.2.0/bits/char_traits.h:39, from C:/dev/msys64/mingw64/include/c++/11.2.0/string:40, from ./fs.h:9, from fs.cpp:5: C:/dev/msys64/mingw64/include/c++/11.2.0/bits/stl_algobase.h:300:5: note: 'std::max' declared here 300 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ ``` It appears that `std::numeric_limits<T>::max` is used without the `limits` header being included. Probably on other STL implementations it's included transitively, but not in the one in MinGW. Including it fixes the compilation problem. Environment: OS: Windows 10 Compiler: gcc 11.2.0 Qt: 5.15.2 (included in msys2) Using the latest mingw w64 shipped with msys2. ACKs for top commit: fanquake: ACK 077a875d94b51e3c87381133657be98989c8643e - Thanks. hebasto: ACK 077a875d94b51e3c87381133657be98989c8643e Tree-SHA512: 2289cb72fa3a28470f4250833be66079482d1392189b1e4679330dad109a8ae67b1d6d51cb635dbc1947c00c6c4cfbc4d7c9ae02269b932cfa1475583adaf73d
This commit is contained in:
parent
62ec84d21a
commit
694264427f
@ -14,6 +14,7 @@
|
|||||||
#define NOMINMAX
|
#define NOMINMAX
|
||||||
#endif
|
#endif
|
||||||
#include <codecvt>
|
#include <codecvt>
|
||||||
|
#include <limits>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user