Open
Bug 530175
Opened 15 years ago
Updated 3 years ago
xpcom analysis type-printer.js error with function pointer parameter
Categories
(Developer Infrastructure :: Source Code Analysis, defect)
Tracking
(Not tracked)
NEW
People
(Reporter: redicke, Unassigned)
References
()
Details
(Keywords: student-project)
Attachments
(1 file, 1 obsolete file)
1.38 KB,
patch
|
benjamin
:
review+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.30729)
Build Identifier: mozilla-central
After generating docs for external strings functions with function pointers in the parameters dump the object. (See "PRInt32 Compare(const PRUnichar*, PRInt32 (*)(const PRUnichar*, const PRUnichar*, PRUint32))" in the link provided for example)
Reproducible: Always
Reporter | ||
Updated•15 years ago
|
Updated•15 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
Updated•15 years ago
|
Assignee: nobody → redicke
Keywords: student-project
Reporter | ||
Comment 1•15 years ago
|
||
I am not sure if there is a better way to display when a function pointer is a parameter. With this it shows the return type and I have never seen a name other than "c".
Attachment #417322 -
Flags: review?(benjamin)
Comment 2•15 years ago
|
||
Comment on attachment 417322 [details] [diff] [review]
If the passed in type as yet another type and it's name is not undefined return the type's name
I'd need an example here to verify behavior, but I don't think this can be right. You should either find a typedef name for the function pointer, or print the full function pointer type, e.g. bool (*)(int, int). Printing the return type of the function will be confusing, not helpful.
Attachment #417322 -
Flags: review?(benjamin) → review-
Reporter | ||
Comment 3•15 years ago
|
||
See:
https://developer.mozilla.org/User:EndersTruth/nsAString#Compare%28const%20PRUnichar*%2C%20PRInt32%20%28*%29
for an example of the malbehavior.
Here:
https://developer.mozilla.org/User:EndersTruth/nsAString_(External)_example#Compare
is an example created using this patch.
Attachment #417322 -
Attachment is obsolete: true
Attachment #425527 -
Flags: review?(benjamin)
Comment 4•15 years ago
|
||
Since this has a typedef, it would be really nice to actually use the typedef name (and even link to the typedef declaration!) instead of expanding the function-pointer type, since most people can't read function pointer types effectively. Can you do that?
Comment 5•15 years ago
|
||
Specifically, I'd like this to prettyprint to:
PRInt32 Compare(const PRUnichar*, ComparatorFunc) const
Comment 6•15 years ago
|
||
Comment on attachment 425527 [details] [diff] [review]
Slight modification to getShortname() and typeName() in xpcom/analysis/type-printer.js
That said, this patch is acceptable since we want it for non-typedefed function pointers.
Attachment #425527 -
Flags: review?(benjamin) → review+
Reporter | ||
Comment 7•15 years ago
|
||
I would like to have this working using the typedef name, if available, as well. However I am not getting any typedef info out of Dehydra. This is because instead of processing the function pointer as a single parameter it goes into an extra type layer and starts defining all of the types in the function it is pointing to. (See my blog post for details on what the type-printer expects and what it receives instead: http://enderstruth.wordpress.com/2010/01/28/reviewing-the-function-pointer-parameter-problem/) This is really what the problem was in the first place, but it was simple to fix higher up. The problem is deeper (I'm guessing??) when Dehydra is extracting the information. I am sure when working only with predefined types it is easy(ier) to pass the data (i.e. to the type-printer), but when any function can be used as a parameter it must complicate things to a great extent. With that, any pointers as to where I should be looking?
Status: NEW → ASSIGNED
Updated•7 years ago
|
Product: Core → Firefox Build System
Updated•6 years ago
|
Assignee: redicke → nobody
Status: ASSIGNED → NEW
Updated•3 years ago
|
Product: Firefox Build System → Developer Infrastructure
Updated•3 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•