SpiderMonkey embedders need to define XP_WIN or XP_UNIX
Categories
(Core :: JavaScript Engine, defect, P3)
Tracking
()
People
(Reporter: Itms, Unassigned)
References
(Blocks 1 open bug)
Details
Steps to reproduce:
We are upgrading embedded SpiderMonkey to ESR 140. On Windows, we've been defining XP_WIN in some of our headers since forever. I see in Bug 661663 that this was not necessary anymore since a long time ago.
Actual results:
When upgrading SpiderMonkey to ESR 140, we get the following error on MSVC:
spidermonkey\include\mozilla\UniquePtrExtensions.h(104,1): error C1189: #error: "Unsupported OS?"
This is fixed by defining XP_WIN globally instead of inside our headers. However, the same compiler error will appear on our other platforms unless we start defining XP_UNIX or XP_DARWIN there.
This also led me to observe that several other headers have code conditionally guarded by XP_WIN, leading to possible behavior differences if the define is forgotten:
jsfriendapi.h, js/RootingAPI.h, mozilla/Assertions.h, mozilla/Attributes.h, mozilla/BaseProfilerUtils.h, mozilla/Casting.h, mozilla/PlatformMutex.h, mozilla/PlatformRWLock.h, mozilla/RefCountType.h, mozilla/TimeStamp.h, mozilla/UniquePtrExtensions.h, mozmemory_wrap.h
Expected results:
The description of Bug 661663 seems to indicate that XP_* preprocessor conditionals should not be present at all in the SM API headers.
| Reporter | ||
Updated•1 year ago
|
Comment 1•1 year ago
|
||
The specific error in UniquePtrExtensions.h may be a duplicate of https://bugzilla.mozilla.org/show_bug.cgi?id=1973994
I agree, it'd be better not to have the public API depend on platform in any headers!
| Reporter | ||
Comment 2•1 year ago
|
||
Thanks Philip, I had not seen this other bug, it's indeed the same underlying issue.
Updated•1 year ago
|
Description
•