Open Bug 530175 Opened 12 years ago Updated 2 years ago

xpcom analysis type-printer.js error with function pointer parameter


(Firefox Build System :: Source Code Analysis, defect)

Not set


(Not tracked)


(Reporter: redicke, Unassigned)




(Keywords: student-project)


(1 file, 1 obsolete file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv: 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
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: 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?
Product: Core → Firefox Build System
Assignee: redicke → nobody
You need to log in before you can comment on or make changes to this bug.