Skip to content

Commit 2e4b9e2

Browse files
Merge pull request #5795 from PastaPastaPasta/develop-trivial-2024-01-01
backports: trivial 2024 01 01
2 parents 7d9c572 + 2ad5d26 commit 2e4b9e2

16 files changed

+146
-141
lines changed

depends/funcs.mk

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,40 +171,40 @@ $($(1)_fetched):
171171
mkdir -p $$(@D) $(SOURCES_PATH)
172172
rm -f $$@
173173
touch $$@
174-
cd $$(@D); $(call $(1)_fetch_cmds,$(1))
174+
cd $$(@D); $($(1)_fetch_cmds)
175175
cd $($(1)_source_dir); $(foreach source,$($(1)_all_sources),$(build_SHA256SUM) $(source) >> $$(@);)
176176
touch $$@
177177
$($(1)_extracted): | $($(1)_fetched)
178178
echo Extracting $(1)...
179179
mkdir -p $$(@D)
180-
cd $$(@D); $(call $(1)_extract_cmds,$(1))
180+
cd $$(@D); $($(1)_extract_cmds)
181181
touch $$@
182182
$($(1)_preprocessed): | $($(1)_extracted)
183183
echo Preprocessing $(1)...
184184
mkdir -p $$(@D) $($(1)_patch_dir)
185185
$(foreach patch,$($(1)_patches),cd $(PATCHES_PATH)/$(1); cp $(patch) $($(1)_patch_dir) ;)
186-
cd $$(@D); $(call $(1)_preprocess_cmds, $(1))
186+
cd $$(@D); $($(1)_preprocess_cmds)
187187
touch $$@
188188
$($(1)_configured): | $($(1)_dependencies) $($(1)_preprocessed)
189189
echo Configuring $(1)...
190190
rm -rf $(host_prefix); mkdir -p $(host_prefix)/lib; cd $(host_prefix); $(foreach package,$($(1)_all_dependencies), $(build_TAR) --no-same-owner -xf $($(package)_cached); )
191191
mkdir -p $$(@D)
192-
+cd $$(@D); $($(1)_config_env) $(call $(1)_config_cmds, $(1))
192+
+cd $$(@D); $($(1)_config_env) $($(1)_config_cmds)
193193
touch $$@
194194
$($(1)_built): | $($(1)_configured)
195195
echo Building $(1)...
196196
mkdir -p $$(@D)
197-
+cd $$(@D); $($(1)_build_env) $(call $(1)_build_cmds, $(1))
197+
+cd $$(@D); $($(1)_build_env) $($(1)_build_cmds)
198198
touch $$@
199199
$($(1)_staged): | $($(1)_built)
200200
echo Staging $(1)...
201201
mkdir -p $($(1)_staging_dir)/$(host_prefix)
202-
cd $($(1)_build_dir); $($(1)_stage_env) $(call $(1)_stage_cmds, $(1))
202+
cd $($(1)_build_dir); $($(1)_stage_env) $($(1)_stage_cmds)
203203
rm -rf $($(1)_extract_dir)
204204
touch $$@
205205
$($(1)_postprocessed): | $($(1)_staged)
206206
echo Postprocessing $(1)...
207-
cd $($(1)_staging_prefix_dir); $(call $(1)_postprocess_cmds)
207+
cd $($(1)_staging_prefix_dir); $($(1)_postprocess_cmds)
208208
touch $$@
209209
$($(1)_cached): | $($(1)_dependencies) $($(1)_postprocessed)
210210
echo Caching $(1)...

doc/developer-notes.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1131,7 +1131,10 @@ A few guidelines for introducing and reviewing new RPC interfaces:
11311131

11321132
- *Rationale*: Consistency with the existing interface.
11331133

1134-
- Argument naming: use snake case `fee_delta` (and not, e.g. camel case `feeDelta`)
1134+
- Argument and field naming: please consider whether there is already a naming
1135+
style or spelling convention in the API for the type of object in question
1136+
(`blockhash`, for example), and if so, try to use that. If not, use snake case
1137+
`fee_delta` (and not, e.g. `feedelta` or camel case `feeDelta`).
11351138

11361139
- *Rationale*: Consistency with the existing interface.
11371140

src/arith_uint256.cpp

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,21 @@ double base_uint<BITS>::getdouble() const
146146
template <unsigned int BITS>
147147
std::string base_uint<BITS>::GetHex() const
148148
{
149-
return ArithToUint256(*this).GetHex();
149+
base_blob<BITS> b;
150+
for (int x = 0; x < this->WIDTH; ++x) {
151+
WriteLE32(b.begin() + x*4, this->pn[x]);
152+
}
153+
return b.GetHex();
150154
}
151155

152156
template <unsigned int BITS>
153157
void base_uint<BITS>::SetHex(const char* psz)
154158
{
155-
*this = UintToArith256(uint256S(psz));
159+
base_blob<BITS> b;
160+
b.SetHex(psz);
161+
for (int x = 0; x < this->WIDTH; ++x) {
162+
this->pn[x] = ReadLE32(b.begin() + x*4);
163+
}
156164
}
157165

158166
template <unsigned int BITS>
@@ -164,7 +172,7 @@ void base_uint<BITS>::SetHex(const std::string& str)
164172
template <unsigned int BITS>
165173
std::string base_uint<BITS>::ToString() const
166174
{
167-
return (GetHex());
175+
return GetHex();
168176
}
169177

170178
template <unsigned int BITS>
@@ -183,20 +191,7 @@ unsigned int base_uint<BITS>::bits() const
183191
}
184192

185193
// Explicit instantiations for base_uint<256>
186-
template base_uint<256>::base_uint(const std::string&);
187-
template base_uint<256>& base_uint<256>::operator<<=(unsigned int);
188-
template base_uint<256>& base_uint<256>::operator>>=(unsigned int);
189-
template base_uint<256>& base_uint<256>::operator*=(uint32_t b32);
190-
template base_uint<256>& base_uint<256>::operator*=(const base_uint<256>& b);
191-
template base_uint<256>& base_uint<256>::operator/=(const base_uint<256>& b);
192-
template int base_uint<256>::CompareTo(const base_uint<256>&) const;
193-
template bool base_uint<256>::EqualTo(uint64_t) const;
194-
template double base_uint<256>::getdouble() const;
195-
template std::string base_uint<256>::GetHex() const;
196-
template std::string base_uint<256>::ToString() const;
197-
template void base_uint<256>::SetHex(const char*);
198-
template void base_uint<256>::SetHex(const std::string&);
199-
template unsigned int base_uint<256>::bits() const;
194+
template class base_uint<256>;
200195

201196
// This implementation directly uses shifts instead of going
202197
// through an intermediate MPI representation.

src/arith_uint256.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,4 +284,6 @@ class arith_uint256 : public base_uint<256> {
284284
uint256 ArithToUint256(const arith_uint256 &);
285285
arith_uint256 UintToArith256(const uint256 &);
286286

287+
extern template class base_uint<256>;
288+
287289
#endif // BITCOIN_ARITH_UINT256_H

src/crypto/sha256.cpp

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -586,17 +586,9 @@ std::string SHA256AutoDetect()
586586
bool have_sse4 = false;
587587
bool have_xsave = false;
588588
bool have_avx = false;
589-
bool have_avx2 = false;
590-
bool have_x86_shani = false;
591-
bool enabled_avx = false;
592-
593-
(void)AVXEnabled;
594-
(void)have_sse4;
595-
(void)have_avx;
596-
(void)have_xsave;
597-
(void)have_avx2;
598-
(void)have_x86_shani;
599-
(void)enabled_avx;
589+
[[maybe_unused]] bool have_avx2 = false;
590+
[[maybe_unused]] bool have_x86_shani = false;
591+
[[maybe_unused]] bool enabled_avx = false;
600592

601593
uint32_t eax, ebx, ecx, edx;
602594
GetCPUID(1, 0, eax, ebx, ecx, edx);
@@ -641,7 +633,7 @@ std::string SHA256AutoDetect()
641633
ret += ",avx2(8way)";
642634
}
643635
#endif
644-
#endif
636+
#endif // defined(USE_ASM) && defined(HAVE_GETCPUID)
645637

646638
#if defined(ENABLE_ARM_SHANI) && !defined(BUILD_BITCOIN_INTERNAL)
647639
bool have_arm_shani = false;

src/init.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -986,7 +986,8 @@ void InitParameterInteraction(ArgsManager& args)
986986
LogPrintf("%s: parameter interaction: -connect set -> setting -listen=0\n", __func__);
987987
}
988988

989-
if (args.IsArgSet("-proxy")) {
989+
std::string proxy_arg = args.GetArg("-proxy", "");
990+
if (proxy_arg != "" && proxy_arg != "0") {
990991
// to protect privacy, do not listen by default if a default proxy server is specified
991992
if (args.SoftSetBoolArg("-listen", false))
992993
LogPrintf("%s: parameter interaction: -proxy set -> setting -listen=0\n", __func__);

src/netbase.cpp

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ enum class IntrRecvError {
301301
*
302302
* @see This function can be interrupted by calling InterruptSocks5(bool).
303303
* Sockets can be made non-blocking with SetSocketNonBlocking(const
304-
* SOCKET&, bool).
304+
* SOCKET&).
305305
*/
306306
static IntrRecvError InterruptibleRecv(uint8_t* data, size_t len, int timeout, const Sock& sock)
307307
{
@@ -514,7 +514,7 @@ std::unique_ptr<Sock> CreateSockTCP(const CService& address_family)
514514
SetSocketNoDelay(hSocket);
515515

516516
// Set the non-blocking option on the socket.
517-
if (!SetSocketNonBlocking(hSocket, true)) {
517+
if (!SetSocketNonBlocking(hSocket)) {
518518
CloseSocket(hSocket);
519519
LogPrintf("Error setting socket to non-blocking: %s\n", NetworkErrorString(WSAGetLastError()));
520520
return nullptr;
@@ -711,28 +711,16 @@ bool LookupSubNet(const std::string& strSubnet, CSubNet& ret, DNSLookupFn dns_lo
711711
return false;
712712
}
713713

714-
bool SetSocketNonBlocking(const SOCKET& hSocket, bool fNonBlocking)
714+
bool SetSocketNonBlocking(const SOCKET& hSocket)
715715
{
716-
if (fNonBlocking) {
717716
#ifdef WIN32
718-
u_long nOne = 1;
719-
if (ioctlsocket(hSocket, FIONBIO, &nOne) == SOCKET_ERROR) {
717+
u_long nOne = 1;
718+
if (ioctlsocket(hSocket, FIONBIO, &nOne) == SOCKET_ERROR) {
720719
#else
721-
int fFlags = fcntl(hSocket, F_GETFL, 0);
722-
if (fcntl(hSocket, F_SETFL, fFlags | O_NONBLOCK) == SOCKET_ERROR) {
720+
int fFlags = fcntl(hSocket, F_GETFL, 0);
721+
if (fcntl(hSocket, F_SETFL, fFlags | O_NONBLOCK) == SOCKET_ERROR) {
723722
#endif
724-
return false;
725-
}
726-
} else {
727-
#ifdef WIN32
728-
u_long nZero = 0;
729-
if (ioctlsocket(hSocket, FIONBIO, &nZero) == SOCKET_ERROR) {
730-
#else
731-
int fFlags = fcntl(hSocket, F_GETFL, 0);
732-
if (fcntl(hSocket, F_SETFL, fFlags & ~O_NONBLOCK) == SOCKET_ERROR) {
733-
#endif
734-
return false;
735-
}
723+
return false;
736724
}
737725

738726
return true;

src/netbase.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,8 @@ bool ConnectSocketDirectly(const CService &addrConnect, const Sock& sock, int nT
205205
*/
206206
bool ConnectThroughProxy(const proxyType& proxy, const std::string& strDest, uint16_t port, const Sock& sock, int nTimeout, bool& outProxyConnectionFailed);
207207

208-
/** Disable or enable blocking-mode for a socket */
209-
bool SetSocketNonBlocking(const SOCKET& hSocket, bool fNonBlocking);
208+
/** Enable non-blocking mode for a socket */
209+
bool SetSocketNonBlocking(const SOCKET& hSocket);
210210
/** Set the TCP_NODELAY flag on a socket */
211211
bool SetSocketNoDelay(const SOCKET& hSocket);
212212
void InterruptSocks5(bool interrupt);

src/qt/bitcoingui.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ public Q_SLOTS:
372372
/** Show window if hidden, unminimize when minimized, rise when obscured or show if hidden and fToggleHidden is true */
373373
void showNormalIfMinimized() { showNormalIfMinimized(false); }
374374
void showNormalIfMinimized(bool fToggleHidden);
375-
/** Simply calls showNormalIfMinimized(true) for use in SLOT() macro */
375+
/** Simply calls showNormalIfMinimized(true) */
376376
void toggleHidden();
377377

378378
/** called by a timer to check if ShutdownRequested() has been set **/

src/support/lockedpool.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -238,12 +238,6 @@ PosixLockedPageAllocator::PosixLockedPageAllocator()
238238
#endif
239239
}
240240

241-
// Some systems (at least OS X) do not define MAP_ANONYMOUS yet and define
242-
// MAP_ANON which is deprecated
243-
#ifndef MAP_ANONYMOUS
244-
#define MAP_ANONYMOUS MAP_ANON
245-
#endif
246-
247241
void *PosixLockedPageAllocator::AllocateLocked(size_t len, bool *lockingSuccess)
248242
{
249243
void *addr;

0 commit comments

Comments
 (0)