Closed Bug 1768632 Opened 3 years ago Closed 2 years ago

EnumSet::kMaxBits won't initialize

Categories

(Core :: JavaScript Engine, defect, P3)

Firefox 102
defect

Tracking

()

RESOLVED FIXED
105 Branch
Tracking Status
firefox-esr102 --- fixed
firefox105 --- fixed

People

(Reporter: liamg_uw, Assigned: anba)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36 Edg/101.0.1210.39

Steps to reproduce:

I am building SpiderMonkey for embedding in a C++ project. First I installed Mozilla Build and bootstrapped the entire mozilla-unified. Then I successfully ran js/src.configure.in, and then ran mozmake.exe and mozmake.exe install. Then I added the include folder to my project, linked mozjs-102a1.lib to my project, and copied mozjs-102a1.dll into my main project folder. Then I tried to compile my project.

Actual results:

I get the following error message on EnumSet.h line 329:

use of undefined type 'mozilla::EnumSet<JS::PropertyAttribute,unsigned char>'

Presumably this is because of some forward declaration issue.

Expected results:

It should compile.

BTW, I am using MSVC.

Did you have a header change that made this work?

Severity: -- → S3
Priority: -- → P3

I tried specifying the template parameters in EnumSet, and I also tried including some extra headers, but I couldn't get it to work. I wonder if it's an MSCV compiler thing.

Hi,

From 1, the approach I did to resolve the build issue with the headers when building against it with Visual Studio is to update line 329 of mozilla/EnumSet.h, and change:

static constexpr size_t kMaxBits = EnumSet().MaxBits();

to

size_t kMaxBits = EnumSet().MaxBits();

and the C2027 error (the error reported by the reporter) will go away. I am not that well-aquainted with the SpiderMonkey sources, so that's the best way I could come up with. The project that uses the embedding would run as expected.

With blessings, thank you!

Assignee: nobody → andrebargull
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 105 Branch

Comment on attachment 9289390 [details]
Bug 1768632: Make EnumSet compile for MSVC. r=glandium!

ESR Uplift Approval Request

  • If this is not a sec:{high,crit} bug, please state case for ESR consideration: Needed for SpiderMonkey embedders on Windows to be able to build with MSVC.
  • User impact if declined: Embedders will have to apply the patch anyway.
  • Fix Landed on Version: 105
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Seems like any errors introduced by the patch should be obvious at compile-time.
Attachment #9289390 - Flags: approval-mozilla-esr102?

Comment on attachment 9289390 [details]
Bug 1768632: Make EnumSet compile for MSVC. r=glandium!

Approved for 102.3esr.

Attachment #9289390 - Flags: approval-mozilla-esr102? → approval-mozilla-esr102+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: