microsoft / microsoft/vscode-cpptools
Incorrect errors when __attribute__ is used on enum values in gcc mode
まだ誰も着手していません。
- 主要言語
- TypeScript
- スター
- 6.2k
- フォーク
- 1.7k
- 平均マージ
- 14時間 46分
- マージ済み PR(30日)
- 61
説明
Type: LanguageService
Describe the bug
- OS and Version: Fedora 31
- VS Code Version: 1.41
- C/C++ Extension Version: 0.26.3
- Other extensions you installed (and if the issue persists after disabling them): TBD (how can I disable every extension except for this one? I have 50 extensions installed.)
- A clear and concise description of what the bug is.
There is an identifier exported from GLib, G_PARAM_STATIC_STRINGS (a macro), that is marked as undefined (has red squiggles) even though I can Ctrl+click it to show the definition. Seeing the definition shows no errors. The file that the macro is defined also reports an unusual error though, where an ending } is expected. Not sure if this is throwing off the language server, but something is off.
To Reproduce
repository in question: https://git.sr.ht/~tristan957/harvest-almanac (also mirrored on my GitHub if more convenient)
example of usage: https://git.sr.ht/~tristan957/harvest-almanac/tree/d5ebeb13fb59b3c99e3c43c290b7b7e7aed51020/harvest-glib/harvest-project.c#L334
c_cpp_properties.json
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/harvest-glib",
"/usr/include/gtk-3.0",
"/usr/include/glib-2.0",
"/usr/lib64/glib-2.0/include",
"/usr/include/pango-1.0",
"/usr/include/cairo",
"/usr/include/gdk-pixbuf-2.0",
"/usr/include/atk-1.0",
"/usr/include/libhandy-0.0",
"/usr/include/json-glib-1.0",
"/usr/include/libsoup-2.4",
"/usr/include/libsecret-1",
"/usr/include/harfbuzz",
"/home/tristan957/.local/include",
"${workspaceFolder}/build/harvest-glib"
],
"defines": [
"__HARVEST_HEADER_INTERNAL__"
],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "gcc-x64",
"compileCommands": "${workspaceFolder}/build/compile_commands.json"
}
],
"version": 4
}
- Open the repo in VSCode
- Go to
harvest-glib/harvest-project.cline 334, see error on line 335 (any .c file should show the same error fyi) - Notice squiggles
- Ctrl+click (now viewing gparam.h) (https://gitlab.gnome.org/GNOME/glib/blob/master/gobject/gparam.h#L175)
- Notice error on line 159 of file (https://gitlab.gnome.org/GNOME/glib/blob/master/gobject/gparam.h#L159)
- Follow the definition of
GLIB_DEPRECATED_ENUMERATOR_IN_2_26to gversionmacros.h and then to gmacros.h - See that
GLIB_DEPRECATED_ENUMERATOR_IN_2_26eventually gets defined as__attribute__((__deprecated__))
Expected behavior
Not misreport a defined identifier.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
付属の c_cpp_properties.json を使用して、まず 334 行目付近の harvest-glib/harvest-project.c から始め、次に 159 行目付近の gparam.h を調べ、gversionmacros.h と gmacros.h を通じて GLIB_DEPRECATED_ENUMERATOR_IN_2_26 をたどります。診断を再現し、定義された G_PARAM_STATIC_STRINGS 識別子と関連する閉じ中かっこの位置が、誤って報告されなくなったことを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- c, vscode
- 領域
- devtools
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 38/100