[tor-dev] MSVC compile failure
Gabriela Moldovan
gabi at torproject.org
Mon Mar 20 11:56:40 UTC 2023
Hi,
On Sat Mar 18, 2023 at 1:05 PM GMT, Gisle Vanem wrote:
> 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.
Ah, I think my changes from 1a60fa54 broke it.
While MSVC is not an officially supported build platform[1], if you want to
submit an MR for the fix, I'd be happy to review it. I would do it myself, but I
don't have an environment where I can test the proposed solution in.
[1]: https://gitlab.torproject.org/tpo/core/team/-/wikis/NetworkTeam/SupportedPlatforms
Best,
Gabi
More information about the tor-dev
mailing list