Add noop do-while to non-DEBUG DXG_TRACE to avoid future compiler warnings

オープン 初心者向け
#13,592 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

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

評価

難易度
1/5
見積もり時間
1〜3時間
初心者へのやさしさ
70/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
c, linux

調査の方向性

drivers/hv/dxgkrnl/dxgkrnl.h の non-DEBUG 用 DXG_TRACE 定義から始め、次に drivers/hv/dxgkrnl/dxgmodule.c の参照されている使用箇所を調べます。添付されたパッチと比較し、non-DEBUG マクロが空の if 本体を生成しなくなっていることを確認します。影響を受ける kernel configuration を WERROR=y でビルドし、警告が回避されることを確認します。

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

説明

feature GPU

Is your feature request related to a problem? Please describe.

As future Linux enables more warning flags^1, some code needs to be changed accordingly to suppress warnings and support WERROR=y builds. One problem is the DXG_TRACE in drivers/hv/dxgkrnl:

https://github.com/microsoft/WSL2-Linux-Kernel/blob/427645e3db3a8896714f22a3d3fe0c3f7b317ad4/drivers/hv/dxgkrnl/dxgkrnl.h#L1031

Uses like the following generates a if statement without a body, which could trigger -Wempty-body warnings:

https://github.com/microsoft/WSL2-Linux-Kernel/blob/427645e3db3a8896714f22a3d3fe0c3f7b317ad4/drivers/hv/dxgkrnl/dxgmodule.c#L597-L599

I encountered this problem in a 3rdparty port (Nevuly/WSL2-Linux-Kernel-Rolling) targeting stable kernel branch. I think upstreaming the patch here would be more beneficial to every user.

Describe the solution you'd like

Adopt the patch as in [^2], thus eliminating this compiler warning from happening in the future.

Describe alternatives you've considered

  • Disable warnings. Not ideal as this may hinder real positives, and implementing the patch has virtually no runtime impact.

Additional context

See also Nevuly/WSL2-Rolling-Kernel-Issue#37.

[^2]: Attachment: 0001-drivers-hv-dxgkrnl-Add-noop-do-while-to-non-DEBUG-DX.patch

主要言語
C++
スター
34.4k
フォーク
1.9k
平均マージ
1日 23時間
マージ済み PR(30日)
166

環境構築

はじめの一歩

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

microsoft/WSL のほかの issue

microsoft/WSL の issue をすべて見る

似ている issue

C++ の issue をもっと見る

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

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