-
Notifications
You must be signed in to change notification settings - Fork 5
Constraint aren't generated correctly for functions declared by typedef #437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Might #408 help with this? (Just a quick reminder; you're probably more familiar with the details than I am.) |
It's definitely relevant, but I don't believe it will fix the issue. |
So weird! What codebase actually does this? |
This is from libarchive. typedef dev_t pack_t(int, unsigned long [], const char **);
pack_t *pack_find(const char *);
pack_t pack_native; |
But there's now way to define an actual function of this type. E.g., you can't do
because there's no way to name the parameters, is that right? So: Seems a bit useless to make a typedef since you have to hand-write the type anyway. Also: What is |
dev_t
pack_native(int n, unsigned long numbers[], const char **error)
{
// .......
}
|
OK that makes sense. Can we handle |
I don't think it correct for either yet. We do get it correct if the typedef dev_t (*pack_t)(int, unsigned long [], const char **); but if it's not a pointer like in libarchive, then the typedef is inlined for for |
Update on this issue following the merge of #408: Typedef declarations are now represented by a typedef void foo(int*);
// converts to
typedef void foo(_Ptr<int> ); Constraints are still not created between the typedef declaration and subsequent function declarations, so functions |
Constraints should be created, right? That is, when I have
I should create a |
Yes, equating |
Yes, sounds good to me. |
In #505 I stop rewriting the declaration so that the typedef is used. The merger works now because the definition's FVC is used as the constraint target. The FVC for the typedef's declaration is constructed differently (probably a bug). I didn't add any constaints between typedef and declaration. So that's a good reason to keep this open if the current solution is not enough. |
A more extreme example to test any potential fix for this issue: typedef int foo1_t(int);
typedef int foo2_t(int);
foo1_t foo_func;
foo2_t foo_func;
int foo_func(int y) { return 1; } |
Uh oh!
There was an error while loading. Please reload this page.
Functions
bar
andbaz
are declared using the same typedef, so their types should be equated and the their pre-declarations should continue to use the typedef.PR #436 address a rewriting error in this example (issue #430), but even after this fix, the typedef is ignored.
The text was updated successfully, but these errors were encountered: