[Webkit-unassigned] [Bug 62222] New: JSStaticFunction and JSStaticValue are overly "const"
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Tue Jun 7 11:29:22 PDT 2011
https://bugs.webkit.org/show_bug.cgi?id=62222
Summary: JSStaticFunction and JSStaticValue are overly "const"
Product: WebKit
Version: 528+ (Nightly build)
Platform: Unspecified
OS/Version: Unspecified
Status: UNCONFIRMED
Severity: Minor
Priority: P2
Component: JavaScriptCore
AssignedTo: webkit-unassigned at lists.webkit.org
ReportedBy: j.mont at me.com
10/3/06 2:30 PM by John Harper:
* SUMMARY
JSStaticFunction has this definition:
typedef struct {
const char* const name; // FIXME: convert UTF8
JSObjectCallAsFunctionCallback callAsFunction;
JSPropertyAttributes attributes;
} JSStaticFunction;
which means that it's impossible to initialize the name field dynamically. E.g. this code:
JSStaticFunction *fun;
fun->name = "something";
fails with a compiler error. There is no reason for the second of those two "const" qualifiers? A cast will be needed to set the structure field..
[...]
it definitely gives a warning for me, in test.c:
#include <JavaScriptCore/JavaScriptCore.h>
static void foo (void)
{
JSStaticFunction *fun;
fun->name = "something";
}
then:
$ cc -c test.c
test.c: In function 'foo':
test.c:7: error: assignment of read-only member 'name'
in my actual code I did this:
*(void **)&funptr->name = (void *) m->desc->jsName;
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list