microsoft / microsoft/vscode-cpptools

Intellisense support for gcc __attribute__((libcall)) not found

Offen
#4,800 5 Kommentare 7 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Feature Request Language Service
Vorherrschende Sprache
TypeScript
Sterne
6.2k
Forks
1.7k
Ø Merge
14 Std. 46 Min.
Gemergte PRs (30 T.)
61

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne damit, die Diagnose in VS Code mit dem bereitgestellten test.c-Beispiel zu reproduzieren und zu untersuchen, wie IntelliSense Aufrufe von Funktionszeigern mit GCC attribute((libcall)) behandelt. Die Arbeit ist abgeschlossen, wenn der Beispielaufruf keine fehlerhafte Wellenlinie erzeugt und dabei das erwartete Argumentverhalten erhalten bleibt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
c, cpp
Bereich
tooling
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.