Closed Bug 1614243 Opened 4 years ago Closed 4 years ago

Have SpiderMonkey public Headers work on Visual Studio too

Categories

(Core :: MFBT, defect)

68 Branch
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla75
Tracking Status
firefox75 --- fixed

People

(Reporter: fanc999, Assigned: Waldo)

Details

Attachments

(2 files)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0

Steps to reproduce:

  • Build and install SpiderMonkey 68.4.2 from the ThunderBird 68.4.2 sources, using LLVM 9.0.0 (clang-cl)
  • Build GJS (https://gitlab.gnome.org/GNOME/gjs) with Visual Studio 2017 15.9.16

Actual results:

  • For files that included mozilla/DbgMacro.h, error C2010 is thrown because GCC-specific varargs syntax is used in the definition of the macros MOZ_DBG and MOZ_DEFINE_DBG.

  • C2487 (member of dll interface class may not be declared with dll interface) is thrown when the file js/AllocPolicy.h is included, for the methods 'onOutOfMemory()' and 'reportAllocOverflow()' of the class 'class TempAllocPolicy : public AllocPolicyBase' are marked with 'JS_FRIEND_API', which is defined as 'MOZ_IMPORT_API', which in turn is defined as '__declspec(dllimport)'. I am not sure of the best way to fix this overall, but it is fixable by removing the 'JS_FRIEND_API' decoration from the prototypes of the afore-mentioned method definitions when I am building against it.

I am attaching a patch for mozilla/DbgMacro.h as a result.

Expected results:

GJS should have built and linked successfully.

Thanks a bunch!

@fanc999: thanks for the patch! Unfortunately I think it will become increasingly difficult to maintain this configuration as headers will probably start relying on more features not supported by MSVC :/

Waldo, can you look at this MFBT patch?

Flags: needinfo?(jwalden)
Attachment #9125379 - Attachment is patch: true
Attachment #9125379 - Attachment mime type: text/x-patch → text/plain
Assignee: nobody → jwalden
Flags: needinfo?(jwalden)
Component: JavaScript Engine → MFBT
Pushed by jwalden@mit.edu:
https://hg.mozilla.org/integration/autoland/rev/0f4fc4e582d3
Make mfbt/DbgMacro.h use standard variadic macro syntax, not gcc/clang extension syntax.  r=froydnj
Status: UNCONFIRMED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla75
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: