Closed Bug 1107416 Opened 10 years ago Closed 10 years ago

Add static_assert reminder to increment XDR_BYTECODE_VERSION_SUBTRAHEND when extending js.msg

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla37

People

(Reporter: cpeterson, Assigned: cpeterson)

Details

Attachments

(1 file)

In bug 1102131, I added two new warning MSG_DEFs to js.msg but forgot to increment XDR_BYTECODE_VERSION_SUBTRAHEND. This patch adds a static_assert to Xdr.h that fails if MSG_DEFs are added or removed to js.msg, reminding developers to update XDR_BYTECODE_VERSION_SUBTRAHEND.
Attachment #8531921 - Flags: review?(shu)
Comment on attachment 8531921 [details] [diff] [review]
xdr-version-assert.patch

Review of attachment 8531921 [details] [diff] [review]:
-----------------------------------------------------------------

Nice.

Could you prefix the static assert message with "GREETINGS, POTENTIAL SUBTRAHEND INCREMENTER!" though?
Attachment #8531921 - Flags: review?(shu) → review+
#included "jsfriendapi.h" for JSErr_Limit definition in non-unified builds:
https://hg.mozilla.org/integration/mozilla-inbound/rev/e448025c6dad
https://hg.mozilla.org/mozilla-central/rev/e448025c6dad
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla37
Chris, why is it necessary to bump the version number when error messages are added?
Flags: needinfo?(cpeterson)
We burn error message numbers into our self-hosted JS.  Do a

  ThrowError(JSMSG_BAD_SYMBOL, v);

with an error number added or removed before it (i.e. pretty much anywhere), and bytecode will have a stale error number in it, and arity will be off, and blah blah blah.  This is compounded by js.msg's reordering to group messages in similar functionality.
Flags: needinfo?(cpeterson)
Thanks, Jeff.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: