Skip to content

Commit bab2f9b

Browse files
CSharperMantleNevuly
authored andcommitted
drivers: hv: dxgkrnl: Add noop do-while to non-DEBUG DXG_TRACE to avoid compiler warnings (Nevuly/WSL2-Rolling-Kernel-Issue#37)
When compiling with no DEBUG, snippets like the following generates a compiler warning on GCC 15 due to DXG_TRACE being expanded into nothing, which in turn leads to build failures when WERROR=y. if (result) DXG_TRACE("..."); An example of error message is as follows: drivers/hv/dxgkrnl/dxgmodule.c: In function ‘dxg_pci_probe_device’: drivers/hv/dxgkrnl/dxgmodule.c:598:43: error: suggest braces around empty body in an ‘if’ statement [-Werror=empty-body] 598 | DXG_TRACE("err: %d", ret); This patch modifies the macro so that it generates a noop do-while loop, serving as a placeholder statement and silencing the warning. Signed-off-by: Rong Bao <[email protected]>
1 parent c40eb1e commit bab2f9b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/hv/dxgkrnl/dxgkrnl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1028,7 +1028,7 @@ void dxgk_validate_ioctls(void);
10281028

10291029
#else
10301030

1031-
#define DXG_TRACE(...)
1031+
#define DXG_TRACE(...) do {} while (0)
10321032
#define DXG_ERR(fmt, ...) do { \
10331033
dev_err(DXGDEV, "%s: " fmt, __func__, ##__VA_ARGS__); \
10341034
} while (0)

0 commit comments

Comments
 (0)