[llvm] [gn] Add "/Zc:preprocessor" build flag on windows (PR #108252)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 12 01:30:29 PDT 2024
https://github.com/GkvJwa updated https://github.com/llvm/llvm-project/pull/108252
>From 8f9a82e8ad1ab67c01dd7518b8ed92ad2e2beeb9 Mon Sep 17 00:00:00 2001
From: GkvJwa <gkvjwa at gmail.com>
Date: Thu, 12 Sep 2024 01:05:15 +0800
Subject: [PATCH 1/2] [gn] Add /Zc:preprocessor on windows
---
llvm/utils/gn/build/BUILD.gn | 3 +++
1 file changed, 3 insertions(+)
diff --git a/llvm/utils/gn/build/BUILD.gn b/llvm/utils/gn/build/BUILD.gn
index 1ccaefdc21c822..11d28f6be6bce9 100644
--- a/llvm/utils/gn/build/BUILD.gn
+++ b/llvm/utils/gn/build/BUILD.gn
@@ -183,6 +183,9 @@ config("compiler_defaults") {
cflags += [ "/EHs-c-" ]
cflags_cc += [ "/std:c++17" ]
+ # expand __VA_ARGS__ in "OPTION(...) LLVM_MAKE_OPT_ID(__VA_ARGS__)"
+ cflags += [ "/Zc:preprocessor" ]
+
# cl.exe doesn't set __cplusplus correctly by default.
# clang-cl gets it right by default, so don't needlessly add the flag there.
if (!is_clang) {
>From 6b53d8db139a456cc9a4db172784a65ac2b54101 Mon Sep 17 00:00:00 2001
From: GkvJwa <gkvjwa at gmail.com>
Date: Thu, 12 Sep 2024 16:30:20 +0800
Subject: [PATCH 2/2] Only use cl.exe add this flags
---
llvm/utils/gn/build/BUILD.gn | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/llvm/utils/gn/build/BUILD.gn b/llvm/utils/gn/build/BUILD.gn
index 11d28f6be6bce9..2724ccfa0ce57e 100644
--- a/llvm/utils/gn/build/BUILD.gn
+++ b/llvm/utils/gn/build/BUILD.gn
@@ -183,12 +183,11 @@ config("compiler_defaults") {
cflags += [ "/EHs-c-" ]
cflags_cc += [ "/std:c++17" ]
- # expand __VA_ARGS__ in "OPTION(...) LLVM_MAKE_OPT_ID(__VA_ARGS__)"
- cflags += [ "/Zc:preprocessor" ]
-
# cl.exe doesn't set __cplusplus correctly by default.
# clang-cl gets it right by default, so don't needlessly add the flag there.
if (!is_clang) {
+ # expand __VA_ARGS__ in "OPTION(...) LLVM_MAKE_OPT_ID(__VA_ARGS__)"
+ cflags += [ "/Zc:preprocessor" ]
cflags_cc += [ "/Zc:__cplusplus" ]
}
More information about the llvm-commits
mailing list