Closed Bug 338678 Opened 19 years ago Closed 19 years ago

Quelling warning: missing initializer

Categories

(Core :: JavaScript Engine, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: igor, Assigned: igor)

References

Details

Attachments

(2 files, 6 obsolete files)

Since JSFunctionSpec nowdays contains 6 members while all native function tables in JS sources still declare just 5 of them, GCC 4.1 produces during a browser compilation 100 or so warnigs about missing initializer. It would be nice to declare the missing 0 and quell the warnings.
Attached patch Implementation (obsolete) (deleted) — Splinter Review
The patch mostly adds trailing ",0" to JSFunctionSpec tables. To avoid lines with more then 80 characters that extra 2 chars would introduce in jsstr.c and make string_methods table more clear, I added temporary shortcuts there: #define GPR (JSFUN_GENERIC_NATIVE | JSFUN_THISP_PRIMITIVE) #define PRI JSFUN_THISP_PRIMITIVE #define STR JSFUN_THISP_STRING
Assignee: general → igor.bukanov
Status: NEW → ASSIGNED
Attachment #222755 - Flags: review?(mrbkap)
For the records: the expansion of JSFunctionSpec happens as a part of bug 334261.
Depends on: 334261
Attached patch Implementation for real (obsolete) (deleted) — Splinter Review
The previous version of the patch was not final one, I forgot to regerate the diff.
Attachment #222755 - Attachment is obsolete: true
Attachment #222758 - Flags: review?(mrbkap)
Attachment #222755 - Flags: review?(mrbkap)
Attached patch Implementation for real really (obsolete) (deleted) — Splinter Review
I should stop a late night hacking, it is almost 03:00 at night here.
Attachment #222758 - Attachment is obsolete: true
Attachment #222759 - Flags: review?(mrbkap)
Attachment #222758 - Flags: review?(mrbkap)
Comment on attachment 222759 [details] [diff] [review] Implementation for real really I'm not thrilled about the shortened names, but I don't really have anything better to propose. Brendan, any comments?
Attachment #222759 - Flags: superreview?(brendan)
Attachment #222759 - Flags: review?(mrbkap)
Attachment #222759 - Flags: review+
Attachment #222759 - Attachment is obsolete: true
Attachment #222798 - Flags: superreview?(brendan)
Attachment #222798 - Flags: review?(mrbkap)
Attachment #222759 - Flags: superreview?(brendan)
(In reply to comment #5) > I'm not thrilled about the shortened names, but I don't really have anything > better to propose. Brendan, any comments? I considred using a layout like: {js_toSource_str, str_toSource, 0,JSFUN_THISP_STRING,0,0}, {"charCodeAt", str_charCodeAt, 1,JSFUN_GENERIC_NATIVE|JSFUN_THISP_PRIMITIVE,0,0}, {"indexOf", str_indexOf, 1,JSFUN_GENERIC_NATIVE|JSFUN_THISP_PRIMITIVE,0,0}, but that looks ugly.
Attachment #222798 - Flags: review?(mrbkap) → review+
Attached patch Extending the patch for js.c (obsolete) (deleted) — Splinter Review
I compiled js shell with the same warning as the optimized build of browser uses and got few more "missing initializer" warnings. This time they were about JSClass without NULLs for optional members. So the version of the patch fixes that using JSCLASS_NO_OPTIONAL_MEMBERS. Plus the patch addresses 2 warnings in js.c about 2 inconsistent sprintf specifications.
Attachment #222798 - Attachment is obsolete: true
Attachment #222844 - Flags: superreview?(brendan)
Attachment #222844 - Flags: review?(mrbkap)
Attachment #222798 - Flags: superreview?(brendan)
Attachment #222844 - Flags: review?(mrbkap) → review+
Comment on attachment 222844 [details] [diff] [review] Extending the patch for js.c Short names seem ok to me (GPR perhaps too terse, but three-letter meme matches up vertically, so don't change it). This is a case where we have to bite the bullet and impose source changes to avoid warnings. Let's hope it pays off down the road. Only alternative that came to mind (too late for me to suggest it to Andreas): make the extra member of JSFunctionSpec uint32, and effectively reserve its upper 16 bits. That would not require source changes. It's not too late to do that. Should we? /be
Attached patch extra,spare->extra (obsolete) (deleted) — Splinter Review
Compatibility is nice so here is a patch that replaces "uint16 extra,spare" by "uint32 extra" and asserts that extra >> 16 == 0. The rest of changes is to ensure that all 5 members of JSFunctionSpec are listed in browser sources. A few files especially in xpinstall declare just first 3 fields.
Attachment #222945 - Flags: superreview?(brendan)
Attachment #222945 - Flags: review?(mrbkap)
Comment on attachment 222945 [details] [diff] [review] extra,spare->extra I don't suppose there's anyway for you to coax Quilt to generate diff -p (and for bonus points -U8 or so)?
Attachment #222945 - Flags: review?(mrbkap) → review+
Comment on attachment 222945 [details] [diff] [review] extra,spare->extra Thanks, this is better. Nit: 0xFFFF0000 seems better to me given uint32 type than ~0xFFFF. Style judgment call ;-). /be
Attachment #222945 - Flags: superreview?(brendan) → superreview+
The above is generated via quilt diff --diff='diff -p -U8' > kill_init_warnings.diff but that requres a recent quilt.
Attachment #222844 - Attachment is obsolete: true
Attachment #222945 - Attachment is obsolete: true
Attachment #222844 - Flags: superreview?(brendan)
I committed the patch from comment 13.
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Attached patch Follow fix I checked in (deleted) — Splinter Review
I just checked this followup fix into the JS 1.7 branch and trunk to quell some MSVC warnings.
Flags: in-testsuite-
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: