Skip to content

Handle valid functions with the same name #2

@matheustavares

Description

@matheustavares

Hi, Chaudron. Thanks for this great tool! There's only one thing I really miss which is handling multiple functions with the same name. As an example, let's imagine a toy-project containing four files: a.c, b.c, header.h and c.c:

a.c:

static void a(void)
{}

void a_wrapper(void)
{
    a();
}

b.c:

void a(void)
{}

header.h:

void a(void);
void a_wrapper(void);

c.c:

#include "header.h"

int main()
{
        a();
        a_wrapper();
        return 0;
}

The result of cally's full graph for this project is:
result

But as we have two different and valid a() declarations in our project, we would expect something like this:
expected

Cally does warn of multiple definitions, which is great. But it would be even better if it could disambiguate the different definitions as they are all valid C constructions.

I know this might be a limitation of the *.expand files format: function calls contain the callee address but function declarations don't show this information, so we cannot disambiguate. But I thought that perhaps raising this issue could hopefully bring up ideas on how this could be resolved (maybe even by using more than just the *.expand files). Any thoughts/ideas on this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions