We can't do it right now because we have static asserts that use them. But waldo says "C++0x constexpr might be able to save the day here, possibly"
Created attachment 393400 [details] [diff] [review] v1
Assignee: general → jorendorff
Attachment #393400 - Flags: review?(jwalden+bmo)
Attachment #393400 - Flags: review?(jwalden+bmo) → review+
Comment on attachment 393400 [details] [diff] [review] v1 Better than nothing, I'm just worried we'll break JSAPI users doing this. I guess it's easy to fix, and they can not upgrade if necessary, but still...
http://hg.mozilla.org/tracemonkey/rev/d6f79987bf06 Cc-ing Brendan because of the concerns raised in comment 2. But we have already turned several other macros into functions. Type safety is worth the breakage. Within SM we broke one thing, and it turned out to be a completely bogus call to INT_TO_JSVAL. See bug 509301.
Status: NEW → RESOLVED
Last Resolved: 9 years ago
Resolution: --- → FIXED
Recap of IRC conversation with jorendorff: - INT_TO_JSVAL_CONSTEXPR() exists now and can take the place of old INT_TO_JSVAL() calls where macro is absolutely required - JSVAL_ZERO and JSVAL_ONE should be changed to use INT_TO_JSVAL_CONSTEXPR() at some point, so that JSAPI users can use them in switch cases
You need to log in before you can comment on or make changes to this bug.