[backport][Clang] Fix build with GCC 14 on ARM (#78704)
Reference: https://github.com/llvm/llvm-project/pull/78704 https://gitee.com/openeuler/llvm-project/pulls/90 GCC 14 defines `__arm_streaming` as a macro expanding to `[[arm::streaming]]`. Due to the nested macro use, this gets expanded prior to concatenation. It doesn't look like C++ has a really clean way to prevent macro expansion. The best I have found is to use `EMPTY ## X` where `EMPTY` is an empty macro argument, so this is the hack I'm implementing here. Fixes https://github.com/llvm/llvm-project/issues/78691. (cherry picked from commit 4a7bc6b56844d331ddb0b76ab0b971072463bcd4)
This commit is contained in:
parent
62e3085581
commit
1906279580
64
0018-backport-Clang-Fix-build-with-GCC-14-on-ARM-78704.patch
Normal file
64
0018-backport-Clang-Fix-build-with-GCC-14-on-ARM-78704.patch
Normal file
@ -0,0 +1,64 @@
|
||||
From 505323d49f4621e5f7210d99fd52dd33a6223fa8 Mon Sep 17 00:00:00 2001
|
||||
From: eastb233 <xiezhiheng@huawei.com>
|
||||
Date: Tue, 3 Sep 2024 11:59:57 +0800
|
||||
Subject: [PATCH] [backport][Clang] Fix build with GCC 14 on ARM (#78704)
|
||||
|
||||
Reference: https://github.com/llvm/llvm-project/pull/78704
|
||||
|
||||
GCC 14 defines `__arm_streaming` as a macro expanding to
|
||||
`[[arm::streaming]]`. Due to the nested macro use, this gets expanded
|
||||
prior to concatenation.
|
||||
|
||||
It doesn't look like C++ has a really clean way to prevent macro
|
||||
expansion. The best I have found is to use `EMPTY ## X` where `EMPTY` is
|
||||
an empty macro argument, so this is the hack I'm implementing here.
|
||||
|
||||
Fixes https://github.com/llvm/llvm-project/issues/78691.
|
||||
---
|
||||
clang/include/clang/Basic/TokenKinds.def | 2 +-
|
||||
clang/include/clang/Basic/TokenKinds.h | 2 +-
|
||||
clang/utils/TableGen/ClangAttrEmitter.cpp | 2 +-
|
||||
3 files changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/clang/include/clang/Basic/TokenKinds.def b/clang/include/clang/Basic/TokenKinds.def
|
||||
index ef0dad0f2dcd..afd101b007b4 100644
|
||||
--- a/clang/include/clang/Basic/TokenKinds.def
|
||||
+++ b/clang/include/clang/Basic/TokenKinds.def
|
||||
@@ -753,7 +753,7 @@ KEYWORD(__builtin_sycl_unique_stable_name, KEYSYCL)
|
||||
|
||||
// Keywords defined by Attr.td.
|
||||
#ifndef KEYWORD_ATTRIBUTE
|
||||
-#define KEYWORD_ATTRIBUTE(X) KEYWORD(X, KEYALL)
|
||||
+#define KEYWORD_ATTRIBUTE(X, EMPTY) KEYWORD(EMPTY ## X, KEYALL)
|
||||
#endif
|
||||
#include "clang/Basic/AttrTokenKinds.inc"
|
||||
|
||||
diff --git a/clang/include/clang/Basic/TokenKinds.h b/clang/include/clang/Basic/TokenKinds.h
|
||||
index e4857405bc7f..ff117bd5afc5 100644
|
||||
--- a/clang/include/clang/Basic/TokenKinds.h
|
||||
+++ b/clang/include/clang/Basic/TokenKinds.h
|
||||
@@ -109,7 +109,7 @@ bool isPragmaAnnotation(TokenKind K);
|
||||
|
||||
inline constexpr bool isRegularKeywordAttribute(TokenKind K) {
|
||||
return (false
|
||||
-#define KEYWORD_ATTRIBUTE(X) || (K == tok::kw_##X)
|
||||
+#define KEYWORD_ATTRIBUTE(X, ...) || (K == tok::kw_##X)
|
||||
#include "clang/Basic/AttrTokenKinds.inc"
|
||||
);
|
||||
}
|
||||
diff --git a/clang/utils/TableGen/ClangAttrEmitter.cpp b/clang/utils/TableGen/ClangAttrEmitter.cpp
|
||||
index b5813c6abc2b..79db17501b64 100644
|
||||
--- a/clang/utils/TableGen/ClangAttrEmitter.cpp
|
||||
+++ b/clang/utils/TableGen/ClangAttrEmitter.cpp
|
||||
@@ -3430,7 +3430,7 @@ void EmitClangAttrTokenKinds(RecordKeeper &Records, raw_ostream &OS) {
|
||||
"RegularKeyword attributes with arguments are not "
|
||||
"yet supported");
|
||||
OS << "KEYWORD_ATTRIBUTE("
|
||||
- << S.getSpellingRecord().getValueAsString("Name") << ")\n";
|
||||
+ << S.getSpellingRecord().getValueAsString("Name") << ", )\n";
|
||||
}
|
||||
OS << "#undef KEYWORD_ATTRIBUTE\n";
|
||||
}
|
||||
--
|
||||
2.38.1.windows.1
|
||||
|
||||
@ -43,7 +43,7 @@
|
||||
|
||||
Name: %{pkg_name}
|
||||
Version: %{clang_version}
|
||||
Release: 21
|
||||
Release: 22
|
||||
Summary: A C language family front-end for LLVM
|
||||
|
||||
License: NCSA
|
||||
@ -69,6 +69,7 @@ Patch14: 0014-Update-llvm-lit-config-to-support-build_for_openeule.patch
|
||||
Patch15: 0015-Backport-Defer-the-instantiation-of-explicit-specifier-until-.patch
|
||||
Patch16: 0016-Add-BiSheng-Autotuner-support-for-LLVM-compiler.patch
|
||||
Patch17: 0017-fix-for-missing-DENABLE_AUTOTUNER.patch
|
||||
Patch18: 0018-backport-Clang-Fix-build-with-GCC-14-on-ARM-78704.patch
|
||||
|
||||
# Patches for clang-tools-extra
|
||||
# See https://reviews.llvm.org/D120301
|
||||
@ -413,6 +414,9 @@ LD_LIBRARY_PATH=%{buildroot}/%{install_libdir} %{__ninja} check-all -C ./_build
|
||||
%{install_bindir}/git-clang-format
|
||||
|
||||
%changelog
|
||||
* Tue Sep 03 2024 eastb233 <xiezhiheng@huawei.com> - 17.0.6-22
|
||||
- Fix build with GCC that supports SME.
|
||||
|
||||
* Tue Aug 20 2024 liyunfei <liyunfei33@huawei.com> - 17.0.6-21
|
||||
- Fix for missing -DENABLE_AUTOTUNER in compilation.
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user