[tor-dev] MSVC compile failure

Gisle Vanem gvanem at online.no
Sat Mar 18 13:05:15 UTC 2023


Hello list. Anybody out there?

Trying to compile Tor with 'cl' ver. 19.36.32323 from
yesterdays 'git master', I got this error in
'src/feature/hs/hs_metrics_entry.c':

hs/hs_metrics_entry.c(98,3): error C2099: initializer is not a constant
   {
   ^
hs/hs_metrics_entry.c(106,3): error C2099: initializer is not a constant
   {
   ^

----------

This MSVC compiler is rather stupid; it fails to parse that
'static const size_t hs_metrics_circ_build_time_buckets_size'

is truly 'const'. No problem with 'clang-cl'.
But this patch works:

--- a/feature/hs/hs_metrics_entry.c 2023-03-17 18:00:57
+++ b/feature/hs/hs_metrics_entry.c 2023-03-18 13:56:58
@@ -28,8 +28,7 @@
    60000  /* 60s */
  };

-static const size_t hs_metrics_circ_build_time_buckets_size =
-  ARRAY_LENGTH(hs_metrics_circ_build_time_buckets);
+#define hs_metrics_circ_build_time_buckets_size ARRAY_LENGTH(hs_metrics_circ_build_time_buckets)

-----------------

Just letting you know here.

-- 
--gv


More information about the tor-dev mailing list