Closed
Bug 338678
Opened 19 years ago
Closed 19 years ago
Quelling warning: missing initializer
Categories
(Core :: JavaScript Engine, enhancement)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
People
(Reporter: igor, Assigned: igor)
References
Details
Attachments
(2 files, 6 obsolete files)
(deleted),
patch
|
Details | Diff | Splinter Review | |
(deleted),
patch
|
Details | Diff | Splinter Review |
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.
Assignee | ||
Comment 1•19 years ago
|
||
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 | ||
Comment 2•19 years ago
|
||
For the records: the expansion of JSFunctionSpec happens as a part of bug 334261.
Depends on: 334261
Assignee | ||
Comment 3•19 years ago
|
||
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)
Assignee | ||
Comment 4•19 years ago
|
||
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 5•19 years ago
|
||
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+
Assignee | ||
Comment 6•19 years ago
|
||
Attachment #222759 -
Attachment is obsolete: true
Attachment #222798 -
Flags: superreview?(brendan)
Attachment #222798 -
Flags: review?(mrbkap)
Attachment #222759 -
Flags: superreview?(brendan)
Assignee | ||
Comment 7•19 years ago
|
||
(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.
Updated•19 years ago
|
Attachment #222798 -
Flags: review?(mrbkap) → review+
Assignee | ||
Comment 8•19 years ago
|
||
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)
Updated•19 years ago
|
Attachment #222844 -
Flags: review?(mrbkap) → review+
Comment 9•19 years ago
|
||
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
Assignee | ||
Comment 10•19 years ago
|
||
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 11•19 years ago
|
||
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 12•19 years ago
|
||
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+
Assignee | ||
Comment 13•19 years ago
|
||
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)
Assignee | ||
Comment 14•19 years ago
|
||
I committed the patch from comment 13.
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Comment 15•19 years ago
|
||
I just checked this followup fix into the JS 1.7 branch and trunk to quell some MSVC warnings.
Updated•18 years ago
|
Flags: in-testsuite-
You need to log in
before you can comment on or make changes to this bug.
Description
•