0e9100b
From bc99ffc770879ff8633128f74dad3159ce3206d3 Mon Sep 17 00:00:00 2001
0e9100b
From: Javier Martinez Canillas <javierm@redhat.com>
0e9100b
Date: Fri, 19 Jan 2024 12:21:07 +0100
0e9100b
Subject: [PATCH] gallium: Undef __arm_streaming macro to workaround clang
0e9100b
 nested expansion
0e9100b
0e9100b
Prior to GCC14, the `__arm_streaming` macro was not spelled as an attribute
0e9100b
using the CXX11 syntax (e.g: [[arm::streaming]]) and so clang expanded that
0e9100b
macro macro.
0e9100b
0e9100b
But since GCC14, it's spelled as `[[arm::streaming]]` which makes clang to
0e9100b
try expanding the attribute again and generating an invalid preprocessing
0e9100b
token due the nested macro usage:
0e9100b
0e9100b
/usr/include/clang/Basic/AttrTokenKinds.inc:9:1: error: pasting "kw_" and "[" does not give a valid preprocessing token
0e9100b
    9 | KEYWORD_ATTRIBUTE(__arm_streaming)
0e9100b
0e9100b
Until this is fixed in clang, let's undefine the __arm_streaming macro.
0e9100b
0e9100b
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
0e9100b
---
0e9100b
 src/compiler/clc/clc_helpers.cpp                      | 2 ++
0e9100b
 src/gallium/frontends/clover/llvm/codegen/bitcode.cpp | 2 ++
0e9100b
 src/gallium/frontends/clover/llvm/codegen/common.cpp  | 2 ++
0e9100b
 src/gallium/frontends/clover/llvm/codegen/native.cpp  | 2 ++
0e9100b
 src/gallium/frontends/clover/llvm/invocation.cpp      | 2 ++
0e9100b
 5 files changed, 10 insertions(+)
0e9100b
0e9100b
diff --git a/src/compiler/clc/clc_helpers.cpp b/src/compiler/clc/clc_helpers.cpp
0e9100b
index 15af4b44c6ce..f8cf4afe74a7 100644
0e9100b
--- a/src/compiler/clc/clc_helpers.cpp
0e9100b
+++ b/src/compiler/clc/clc_helpers.cpp
0e9100b
@@ -23,6 +23,8 @@
0e9100b
 // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
0e9100b
 // OTHER DEALINGS IN THE SOFTWARE.
0e9100b
 
0e9100b
+#undef __arm_streaming
0e9100b
+
0e9100b
 #include <filesystem>
0e9100b
 #include <sstream>
0e9100b
 #include <mutex>
0e9100b
diff --git a/src/gallium/frontends/clover/llvm/codegen/bitcode.cpp b/src/gallium/frontends/clover/llvm/codegen/bitcode.cpp
0e9100b
index 568bdd993f59..00e10672f973 100644
0e9100b
--- a/src/gallium/frontends/clover/llvm/codegen/bitcode.cpp
0e9100b
+++ b/src/gallium/frontends/clover/llvm/codegen/bitcode.cpp
0e9100b
@@ -31,6 +31,8 @@
0e9100b
 /// after linking against other bitcode object files.
0e9100b
 ///
0e9100b
 
0e9100b
+#undef __arm_streaming
0e9100b
+
0e9100b
 #include <llvm/Support/Allocator.h>
0e9100b
 
0e9100b
 #include "llvm/codegen.hpp"
0e9100b
diff --git a/src/gallium/frontends/clover/llvm/codegen/common.cpp b/src/gallium/frontends/clover/llvm/codegen/common.cpp
0e9100b
index fe5fc768bcd5..f659b35283b5 100644
0e9100b
--- a/src/gallium/frontends/clover/llvm/codegen/common.cpp
0e9100b
+++ b/src/gallium/frontends/clover/llvm/codegen/common.cpp
0e9100b
@@ -30,6 +30,8 @@
0e9100b
 /// understood by pipe drivers.
0e9100b
 ///
0e9100b
 
0e9100b
+#undef __arm_streaming
0e9100b
+
0e9100b
 #include <llvm/IR/Type.h>
0e9100b
 #include <llvm/Support/Allocator.h>
0e9100b
 
0e9100b
diff --git a/src/gallium/frontends/clover/llvm/codegen/native.cpp b/src/gallium/frontends/clover/llvm/codegen/native.cpp
0e9100b
index 72046c8a1881..e115e06cbbb6 100644
0e9100b
--- a/src/gallium/frontends/clover/llvm/codegen/native.cpp
0e9100b
+++ b/src/gallium/frontends/clover/llvm/codegen/native.cpp
0e9100b
@@ -27,6 +27,8 @@
0e9100b
 /// executable code as an ELF object file.
0e9100b
 ///
0e9100b
 
0e9100b
+#undef __arm_streaming
0e9100b
+
0e9100b
 #include <llvm/Target/TargetMachine.h>
0e9100b
 #include <llvm/Transforms/Utils/Cloning.h>
0e9100b
 
0e9100b
diff --git a/src/gallium/frontends/clover/llvm/invocation.cpp b/src/gallium/frontends/clover/llvm/invocation.cpp
0e9100b
index 6ab32befbcd3..287af9891015 100644
0e9100b
--- a/src/gallium/frontends/clover/llvm/invocation.cpp
0e9100b
+++ b/src/gallium/frontends/clover/llvm/invocation.cpp
0e9100b
@@ -24,6 +24,8 @@
0e9100b
 // OTHER DEALINGS IN THE SOFTWARE.
0e9100b
 //
0e9100b
 
0e9100b
+#undef __arm_streaming
0e9100b
+
0e9100b
 #include <llvm/IR/DiagnosticPrinter.h>
0e9100b
 #include <llvm/IR/DiagnosticInfo.h>
0e9100b
 #include <llvm/IR/LLVMContext.h>
0e9100b
-- 
0e9100b
2.43.0
0e9100b