Skip to content
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

ClaiR does not parse header files for function pointers in arguments #25

Open
pvstralen opened this issue Apr 8, 2022 · 8 comments
Open

Comments

@pvstralen
Copy link

I am parsing a header file using Rascal ClaiR:

iFile = toLocation("file://D:/test.h");
ast = parseCpp(iFile);
iprint(ast);

The header file test.h looks as follows:

#ifndef TEST_H
#define TEST_H

/* Generic function */
result_t API get_data(query_h query, char **string, result_t *res);
result_t API   set_data(node_h node,   const char *string);
result_t API update_data(node_h node, char ***names, uint32_t *count);

#endif

As an outcome I get multiple errors like this:

decl=|cpp+parameter:///update_data(org.eclipse.cdt.internal.core.dom.parser.ProblemType@53e470da,char...,%3F.)/count|),

@rodinaarssen
Copy link
Member

Hi Peter,

Thanks for the report, I'll look into it!

@pvstralen
Copy link
Author

Hi @rodinaarssen ,

Do you already had a change to look at it?

Regards,

Peter

@jurgenvinju
Copy link
Member

The fix seems clear, but we are stuck between Java 8 and Java 11 compatible releases of Rascal. Current progress is made by porting Clair to Java 11 and the latest Eclipse releases and adding GitHub actions for running the tests. After that we can fix this issue and test it, and then perhaps backport it to the older releases. So a small bug, with a lot of collatoral damage :-)

@rodinaarssen
Copy link
Member

In short: function pointers are not the issue here. In fact, the ProblemTypes are expected. After all, declarations for result_t, API, node_h and uint32_t are missing. However, the toString of the ProblemType class should definitely not end up in the decl.

@pvstralen
Copy link
Author

In short: function pointers are not the issue here. In fact, the ProblemTypes are expected. After all, declarations for result_t, API, node_h and uint32_t are missing. However, the toString of the ProblemType class should definitely not end up in the decl.

Does this mean that if a declaration is added for all the types it will work?

@jurgenvinju
Copy link
Member

Hi Peter; Yes that would hide the current issue and it's a reasonable workaround, but we will also fix the bug :-)

@jurgenvinju
Copy link
Member

@rodinaarssen let's have a look at this week, since we now are on Java 11 and all the latest dependencies.

@jurgenvinju
Copy link
Member

See also #50

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants