[all-commits] [llvm/llvm-project] 03f86c: [Support][Driver][LLDB] Guard WIN32_LEAN_AND_MEAN ...
David Young via All-commits
all-commits at lists.llvm.org
Tue Aug 4 13:32:35 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 03f86c6d4d55809f9531b5e37eb8249e569746aa
https://github.com/llvm/llvm-project/commit/03f86c6d4d55809f9531b5e37eb8249e569746aa
Author: David Young <davidayoung at meta.com>
Date: 2026-08-04 (Tue, 04 Aug 2026)
Changed paths:
M clang/lib/Driver/ToolChains/MSVC.cpp
M lldb/include/lldb/Host/windows/windows.h
M llvm/include/llvm/Support/Windows/WindowsSupport.h
M llvm/lib/WindowsDriver/MSVCPaths.cpp
Log Message:
-----------
[Support][Driver][LLDB] Guard WIN32_LEAN_AND_MEAN definitions with #ifndef (#213045)
Several Windows headers/TUs unconditionally `#define
WIN32_LEAN_AND_MEAN`. When a build predefines the macro on the compiler
command line (e.g. a toolchain that passes -DWIN32_LEAN_AND_MEAN, which
clang treats as `#define WIN32_LEAN_AND_MEAN 1`), the differing token
lists trigger -Wmacro-redefined, which becomes a hard error under
-Werror.
Guard the definitions with #ifndef, matching the adjacent NOMINMAX
handling and the existing pattern in
llvm/lib/Support/rpmalloc/rpmalloc.c. The macro is only a presence flag,
so keeping an externally-provided definition is correct.
Sites guarded:
llvm/include/llvm/Support/Windows/WindowsSupport.h
llvm/lib/WindowsDriver/MSVCPaths.cpp
clang/lib/Driver/ToolChains/MSVC.cpp
lldb/include/lldb/Host/windows/windows.h
Meta ran into this internally building lldb on window after a sync with
upstream from July commit, so adding guards would allow us to drop a
workaround of ignoring the duplicate defines.
Error:
llvm\include\llvm/Support/Windows/WindowsSupport.h(29,9): error:
'WIN32_LEAN_AND_MEAN' macro redefined [-Werror,-Wmacro-redefined]
29 | #define WIN32_LEAN_AND_MEAN
| ^
<command line>(10,9): note: previous definition is here
10 | #define WIN32_LEAN_AND_MEAN 1
| ^
1 error generated.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list