diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-10-22 12:28:03 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-10-22 12:28:06 +0200 |
commit | 4833d1fdf39fb4e3dc45b76960b769d641eca4b8 (patch) | |
tree | 78ffc1c0c8b72cfbf14e70c0558a7b379ffa34fb /src/util/syscall_sandbox.cpp | |
parent | 9469ffcb17f0018b61f85f835cc8b49370d26d1f (diff) | |
parent | 077a875d94b51e3c87381133657be98989c8643e (diff) |
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
Diffstat (limited to 'src/util/syscall_sandbox.cpp')
0 files changed, 0 insertions, 0 deletions