Andrew Pinski wrote:
> Again C has different rules from C++.
> In C, the following two TUs combined together are still valid code while in 
> C++,
> they are invalid.
> 
> tu1.c:
> 
> struct a
> {
>   int t;
> };
> void f(struct a);
> 
> ---------------- cut ---------------------
> tu2.c:
> 
> typedef struct
> {
>   int t;
> }b;
> void f(b a);
> ---------------- cut ---------------------
> 

I think I am going to have to use a non-optimal solution for function
pointer type matches. I am creating a pessimistic/over-expanded
callgraph by saying that a function pointer call MAY call any function
whose function pointer type matches the call and whose address has been
taken somewhere in the source code. So maybe I can make it even more
pessimistic in the C case and match all structs/unions as being the
"same" for the purposes of testing function pointer equality.

Maybe it is also possible to somehow generate a "type string" based on
the contents of the struct/union in C, however I am not sure how I would
get that to inter-operate with C++ since C++ may treat two structures
with the same contents as different types. I might just go for the
pessimistic match first and look at improving things later on once the
rest of it is all up and going.

Thanks for the input,
Brendon.



Reply via email to