microsoft / microsoft/vscode-cpptools
Intellisense support for gcc __attribute__((libcall)) not found
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 1.7k
- Avg merge
- 14h 46m
- Merged PRs (30d)
- 61
Description
Type: LanguageService
Describe the bug
Certain c libraries use the ((libcall)) attribute in gcc to create interface structs for functions. What it does is it passes the interface base as first argument transparently when calling the function. Like this:
IInterface->SomeFunciton (arg1, arg2, etc);
becomes
IInterface->SomeFunction(IInterface, arg1, arg2, etc);
when constructing the call.
This is not supported in IntelliSense with the current c/c++. It would be a nice-to-have feature when working with these libraries.
- OS and Version: Mac OS X, Windows, Chrome OS
- VS Code Version: Latest
- C/C++ Extension Version: Latest
- Other extensions you installed (and if the issue persists after disabling them):
- A clear and concise description of what the bug is.
To Reproduce
Copy/paste this in vscode and save as test.c:
`#ifdef amigaos4
#ifndef APICALL
#define APICALL attribute((libcall))
#endif
struct IntuitionIFace
{
unsigned int APICALL (*Obtain)(struct IntuitionIFace *Self, const char *arg1, char arg2);
unsigned int APICALL (*Release)(struct IntuitionIFace *Self, char arg3, short arg4);
} iface;
int main() {
struct IntuitionIFace *IIntuition = &iface;
//this below is the call
IIntuition->Obtain("Hello world", 'b');
}
#endif`
It will give am error squiggle at the end of last call.
Expected behavior
No error squiggle. The above compiles and runs with no errors in ppc-amigaos-gcc.
Screenshots
Additional context
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the diagnostic in VS Code with the provided test.c sample and inspect how IntelliSense handles the GCC attribute((libcall)) function-pointer calls. The work is done when the sample call produces no erroneous squiggle while preserving the expected argument behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, cpp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100