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)

x86_64
Linux
defect

Tracking

(Not tracked)

People

(Reporter: redicke, Unassigned)

References

()

Details

(Keywords: student-project)

Attachments

(1 file, 1 obsolete file)

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
Depends on: 529978, 530166
Status: UNCONFIRMED → NEW
Ever confirmed: true
Assignee: nobody → redicke
Keywords: student-project
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 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-
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?
Specifically, I'd like this to prettyprint to: PRInt32 Compare(const PRUnichar*, ComparatorFunc) const
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+
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
Product: Core → Firefox Build System
Assignee: redicke → nobody
Status: ASSIGNED → NEW
Product: Firefox Build System → Developer Infrastructure
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: