microsoft / microsoft/vscode-cpptools

X-Macro expansion false error.

オープン
#14,435 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

bug Language Service verified Visual Studio
主要言語
TypeScript
スター
6.2k
フォーク
1.7k
平均マージ
14時間 46分
マージ済み PR(30日)
61

説明

Environment
  • OS and Version: Debian GNU/Linux 13 Trixie
  • VS Code Version: 1.119.0
  • C/C++ Extension Version: 1.32.2
Bug Summary and Steps to Reproduce

Bug Summary:
False error with X-Macros.

Steps to reproduce:

  1. Create a new C file colors.def for example with this content :
COLOR(RED)
COLOR(GREEN)
COLOR(BLUE)
  1. Create another C file like main.c with this content :
enum colors_t {
#define COLOR(NAME) NAME,
#include "colors.def"
#undef COLOR
};
  1. See the false error "expected an identifier" but compilation works perfectly.

Expected behavior:
No false error as the macro should expand and complete the enum.

Configuration and Logs
{
    "configurations": [
        {
            "name": "Default",
        }
    ],
    "version": 4
}
Other Extensions

Issue still persist after disabling any other extensions.

Additional context

This is not a fatal error since it is only visual but it is a problem in intellisense that shows up error even if there are not...

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

レポートで指定されている2つのファイル、colors.def と main.c を、示されている X-macro パターンを使って再現してください。IntelliSense がインクルードされたマクロ展開をどのように解析するかを追跡し、なぜ「expected an identifier」と報告するのかを特定してください。例が引き続き正常にコンパイルでき、誤った診断が消えれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
c
領域
devtools
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
48/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。