[tor-dev] MSVC compile failure

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
_______________________________________________
tor-dev mailing list
tor-dev@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev

Hi,

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]: SupportedPlatforms · Wiki · The Tor Project / Core / Team · GitLab

Best,
Gabi

···

On Sat Mar 18, 2023 at 1:05 PM GMT, Gisle Vanem wrote:
_______________________________________________
tor-dev mailing list
tor-dev@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev

Gabriela Moldovan wrote:

Hi,

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]: SupportedPlatforms · Wiki · The Tor Project / Core / Team · GitLab

If MSVC is not among the supported compilers, it's a real pity.
It used to be. So why not anymore?

So I could not be bothered with a MR (whatever that is).
You mean PR?

···

On Sat Mar 18, 2023 at 1:05 PM GMT, Gisle Vanem wrote:

--
--gv
_______________________________________________
tor-dev mailing list
tor-dev@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev

Hi,

If MSVC is not among the supported compilers, it's a real pity.
It used to be. So why not anymore?

I'm not sure, it must have happened before my time.

So I could not be bothered with a MR (whatever that is).
You mean PR?

Yeah, I meant PR (it's called MR in gitlab parlance).

Gabi

···

On Tue Mar 21, 2023 at 10:45 AM GMT, Gisle Vanem wrote:
_______________________________________________
tor-dev mailing list
tor-dev@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev