commit d88ff67f926ef1d526d4100184891207ec7b754b
parent fc771163d9f0aad72614e9806742a0a289e40644
Author: David Goulet <dgoulet@torproject.org>
Date: Thu, 12 Feb 2026 13:35:24 +0000
Merge branch 'ahf/049-windows-x-compile-fixes' into 'main'
Various Windows build fixes
See merge request tpo/core/tor!987
Diffstat:
8 files changed, 42 insertions(+), 8 deletions(-)
diff --git a/acinclude.m4 b/acinclude.m4
@@ -9,6 +9,8 @@ AC_DEFUN([TOR_EXTEND_CODEPATH],
[
if test -d "$1/lib"; then
LDFLAGS="-L$1/lib $LDFLAGS"
+ elif test -d "$1/lib64"; then
+ LDFLAGS="-L$1/lib64 $LDFLAGS"
else
LDFLAGS="-L$1 $LDFLAGS"
fi
@@ -28,6 +30,9 @@ AC_DEFUN([TOR_DEFINE_CODEPATH],
if test -d "$1/lib"; then
TOR_LDFLAGS_$2="-L$1/lib"
TOR_LIBDIR_$2="$1/lib"
+ elif test -d "$1/lib64"; then
+ TOR_LDFLAGS_$2="-L$1/lib64"
+ TOR_LIBDIR_$2="$1/lib64"
else
TOR_LDFLAGS_$2="-L$1"
TOR_LIBDIR_$2="$1"
diff --git a/changes/ticket41214 b/changes/ticket41214
@@ -0,0 +1,2 @@
+ o Minor features (windows):
+ - Various compilation fixes for our Windows CI. Closes ticket 41214.
diff --git a/src/app/main/ntmain.c b/src/app/main/ntmain.c
@@ -66,7 +66,7 @@ static int nt_service_cmd_stop(void);
/** Struct to hold dynamically loaded NT-service related function pointers.
*/
-struct {
+typedef struct nt_services {
int loaded;
/** @{ */
@@ -143,7 +143,9 @@ struct {
LPDWORD cchReferencedDomainName,
PSID_NAME_USE peUse);
/** @} */
-} service_fns = { 0,
+} nt_services_t;
+
+static nt_services_t service_fns = { 0,
NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL,
NULL};
diff --git a/src/core/or/conflux.c b/src/core/or/conflux.c
@@ -906,7 +906,8 @@ conflux_process_relay_msg(conflux_t *cfx, circuit_t *in_circ,
static ratelim_t rlimit = RATELIM_INIT(60 * 60);
log_fn_ratelim(&rlimit, LOG_WARN, LD_CIRC,
"Conflux OOO queue is at maximum. Currently at "
- "%zu bytes, maximum allowed is %u bytes. Closing.",
+ "%"TOR_PRIuSZ " bytes, maximum allowed is %u bytes. "
+ "Closing.",
cfx->ooo_q_alloc_cost, conflux_params_get_max_oooq());
circuit_mark_for_close(in_circ, END_CIRC_REASON_RESOURCELIMIT);
return false;
diff --git a/src/core/or/relay.c b/src/core/or/relay.c
@@ -2889,8 +2889,9 @@ cell_queues_check_size(void)
alloc -= removed;
static ratelim_t hs_cache_oom_ratelim = RATELIM_INIT(600);
log_fn_ratelim(&hs_cache_oom_ratelim, LOG_NOTICE, LD_REND,
- "HSDir cache exceeded limit (%zu > %"PRIu64" bytes). "
- "Pruned %zu bytes during cell_queues_check_size.",
+ "HSDir cache exceeded limit "
+ "(%"TOR_PRIuSZ " > %"PRIu64 " bytes). "
+ "Pruned %"TOR_PRIuSZ " bytes during cell_queues_check_size.",
hs_cache_total, hs_cache_get_max_bytes(), removed);
}
if (geoip_client_cache_total > get_options()->MaxMemInQueues / 5) {
diff --git a/src/ext/polyval/polyval.c b/src/ext/polyval/polyval.c
@@ -36,6 +36,7 @@
*/
#include "ext/polyval/polyval.h"
+#include "lib/cc/compat_compiler.h"
#include <string.h>
@@ -139,6 +140,7 @@ bswap32(uint64_t v)
#ifdef PV_USE_PCLMUL
#include "ext/polyval/pclmul.c"
+DISABLE_GCC_WARNING("-Waggregate-return")
static inline u128
u128_from_bytes_pclmul(const uint8_t *bytes)
{
@@ -146,6 +148,8 @@ u128_from_bytes_pclmul(const uint8_t *bytes)
PCLMUL_MEMBER(r) = _mm_loadu_si128((const __m128i*)bytes);
return r;
}
+ENABLE_GCC_WARNING("-Waggregate-return")
+
static inline void
u128_to_bytes_pclmul(u128 val, uint8_t *bytes_out)
{
@@ -162,6 +166,7 @@ pv_xor_y_pclmul(polyval_t *pv, u128 v)
#if defined(PV_USE_CTMUL64)
#include "ext/polyval/ctmul64.c"
+DISABLE_GCC_WARNING("-Waggregate-return")
static inline u128
u128_from_bytes_ctmul64(const uint8_t *bytes)
{
@@ -172,6 +177,8 @@ u128_from_bytes_ctmul64(const uint8_t *bytes)
CTMUL64_MEMBER(r).hi = convert_byte_order64(CTMUL64_MEMBER(r).hi);
return r;
}
+ENABLE_GCC_WARNING("-Waggregate-return")
+
static inline void
u128_to_bytes_ctmul64(u128 val, uint8_t *bytes_out)
{
@@ -191,6 +198,7 @@ pv_xor_y_ctmul64(polyval_t *pv, u128 val)
#if defined(PV_USE_CTMUL)
#include "ext/polyval/ctmul.c"
+DISABLE_GCC_WARNING("-Waggregate-return")
static inline u128
u128_from_bytes_ctmul(const uint8_t *bytes)
{
@@ -201,6 +209,8 @@ u128_from_bytes_ctmul(const uint8_t *bytes)
}
return r;
}
+ENABLE_GCC_WARNING("-Waggregate-return")
+
static inline void
u128_to_bytes_ctmul(u128 val, uint8_t *bytes_out)
{
@@ -240,6 +250,7 @@ static inline void expand_key_none(const polyval_t *inp,
* caused warnings with some comparisons. */
#define BLOCK_STRIDE_NONE 0xffff
+DISABLE_GCC_WARNING("-Waggregate-return")
#define PV_DECLARE(prefix, \
st, \
u128_from_bytes, \
@@ -308,6 +319,7 @@ static inline void expand_key_none(const polyval_t *inp,
{ \
memset(&pv->y, 0, sizeof(u128)); \
}
+ENABLE_GCC_WARNING("-Waggregate-return")
#ifdef PV_USE_PCLMUL_DETECT
/* We use a boolean to distinguish whether to use the PCLMUL instructions,
@@ -318,6 +330,7 @@ static bool use_pclmul = false;
/* Declare _both_ variations of our code, statically,
* with different prefixes. */
+DISABLE_GCC_WARNING("-Waggregate-return")
PV_DECLARE(pclmul_, static,
u128_from_bytes_pclmul,
u128_to_bytes_pclmul,
@@ -337,6 +350,7 @@ PV_DECLARE(ctmul64_, static,
struct expanded_key_none,
expand_key_none,
add_multiple_none)
+ENABLE_GCC_WARNING("-Waggregate-return")
void
polyval_key_init(polyval_key_t *pv, const uint8_t *key)
@@ -417,6 +431,7 @@ PV_DECLARE(, ,
add_multiple_none)
#elif defined(PV_USE_CTMUL)
+DISABLE_GCC_WARNING("-Waggregate-return")
PV_DECLARE(, , u128_from_bytes_ctmul,
u128_to_bytes_ctmul,
pv_xor_y_ctmul,
@@ -425,6 +440,7 @@ PV_DECLARE(, , u128_from_bytes_ctmul,
struct expanded_key_none,
expand_key_none,
add_multiple_none)
+ENABLE_GCC_WARNING("-Waggregate-return")
#endif
#ifdef PV_USE_PCLMUL_DETECT
diff --git a/src/feature/hs/hs_cache.c b/src/feature/hs/hs_cache.c
@@ -170,8 +170,9 @@ cache_store_v3_as_dir(hs_cache_dir_descriptor_t *desc)
size_t removed = hs_cache_handle_oom(bytes_to_remove);
static ratelim_t hs_cache_oom_ratelim = RATELIM_INIT(600);
log_fn_ratelim(&hs_cache_oom_ratelim, LOG_NOTICE, LD_REND,
- "HSDir cache exceeded limit (%zu > %zu bytes). "
- "Pruned %zu bytes during an HS descriptor upload.",
+ "HSDir cache exceeded limit "
+ "(%"TOR_PRIuSZ " > %"TOR_PRIuSZ " bytes). "
+ "Pruned %"TOR_PRIuSZ " bytes during an HS descriptor upload.",
current_cache_bytes, max_cache_bytes, removed);
}
diff --git a/src/lib/net/socket.c b/src/lib/net/socket.c
@@ -652,7 +652,13 @@ tor_socket_errno(tor_socket_t sock)
#if defined(_WIN32)
#define E(code, s) { code, (s " [" #code " ]") }
-struct { int code; const char *msg; } windows_socket_errors[] = {
+
+typedef struct windows_socket_error {
+ int code;
+ const char *msg;
+} windows_socket_error_t;
+
+static windows_socket_error_t windows_socket_errors[] = {
E(WSAEINTR, "Interrupted function call"),
E(WSAEACCES, "Permission denied"),
E(WSAEFAULT, "Bad address"),