clang_39: fix build w/gcc9

This commit is contained in:
Maximilian Bosch 2019-12-30 02:08:44 +01:00
parent 3ff62fe45b
commit 2e5fd9f03e
No known key found for this signature in database
GPG Key ID: 091DBF4D1FC46B8E
2 changed files with 67 additions and 1 deletions

View File

@ -0,0 +1,63 @@
From 7225c7754cc3431d05df367c60f309f27586f188 Mon Sep 17 00:00:00 2001
From: Maximilian Bosch <maximilian@mbosch.me>
Date: Mon, 30 Dec 2019 01:42:52 +0100
Subject: [PATCH] Fix compilation w/gcc9
Build broken with the following errors:
```
clang> /build/clang/lib/CodeGen/CGOpenMPRuntime.cpp: In lambda function:
clang> /build/clang/lib/CodeGen/CGOpenMPRuntime.cpp:6078:55: error: lambda parameter 'CGF' previously declared as a capture
clang> 6078 | &NumOfPtrs](CodeGenFunction &CGF, PrePostActionTy &) {
clang> | ~~~~~~~~~~~~~~~~~^~~
clang> /build/clang/lib/CodeGen/CGOpenMPRuntime.cpp: In lambda function:
clang> /build/clang/lib/CodeGen/CGOpenMPRuntime.cpp:6126:53: error: lambda parameter 'CGF' previously declared as a capture
clang> 6126 | &NumOfPtrs](CodeGenFunction &CGF, PrePostActionTy &) {
clang> | ~~~~~~~~~~~~~~~~~^~~
clang> /build/clang/lib/CodeGen/CGOpenMPRuntime.cpp: In lambda function:
clang> /build/clang/lib/CodeGen/CGOpenMPRuntime.cpp:6191:56: error: lambda parameter 'CGF' previously declared as a capture
clang> 6191 | auto &&ThenGen = [&D, &CGF, Device](CodeGenFunction &CGF, PrePostActionTy &) {
clang> | ~~~~~~~~~~~~~~~~~^~~
```
This was due to a bug about name-collisions fixed in GCC 9.0[1].
[1] http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#2211
---
lib/CodeGen/CGOpenMPRuntime.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/CodeGen/CGOpenMPRuntime.cpp b/lib/CodeGen/CGOpenMPRuntime.cpp
index 6a0edbe..96c281c 100644
--- a/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -6073,7 +6073,7 @@ void CGOpenMPRuntime::emitTargetDataCalls(CodeGenFunction &CGF,
// Generate the code for the opening of the data environment. Capture all the
// arguments of the runtime call by reference because they are used in the
// closing of the region.
- auto &&BeginThenGen = [&D, &CGF, &BasePointersArray, &PointersArray,
+ auto &&BeginThenGen = [&D, &BasePointersArray, &PointersArray,
&SizesArray, &MapTypesArray, Device,
&NumOfPtrs](CodeGenFunction &CGF, PrePostActionTy &) {
// Fill up the arrays with all the mapped variables.
@@ -6121,7 +6121,7 @@ void CGOpenMPRuntime::emitTargetDataCalls(CodeGenFunction &CGF,
};
// Generate code for the closing of the data region.
- auto &&EndThenGen = [&CGF, &BasePointersArray, &PointersArray, &SizesArray,
+ auto &&EndThenGen = [&BasePointersArray, &PointersArray, &SizesArray,
&MapTypesArray, Device,
&NumOfPtrs](CodeGenFunction &CGF, PrePostActionTy &) {
assert(BasePointersArray && PointersArray && SizesArray && MapTypesArray &&
@@ -6188,7 +6188,7 @@ void CGOpenMPRuntime::emitTargetDataStandAloneCall(
"Expecting either target enter, exit data, or update directives.");
// Generate the code for the opening of the data environment.
- auto &&ThenGen = [&D, &CGF, Device](CodeGenFunction &CGF, PrePostActionTy &) {
+ auto &&ThenGen = [&D, Device](CodeGenFunction &CGF, PrePostActionTy &) {
// Fill up the arrays with all the mapped variables.
MappableExprsHandler::MapValuesArrayTy BasePointers;
MappableExprsHandler::MapValuesArrayTy Pointers;
--
2.23.1

View File

@ -27,7 +27,10 @@ let
(stdenv.lib.optional stdenv.isLinux "-DGCC_INSTALL_PREFIX=${gcc}") ++
(stdenv.lib.optional (stdenv.cc.libc != null) "-DC_INCLUDE_DIRS=${stdenv.cc.libc}/include");
patches = [ ./purity.patch ];
patches = [
./purity.patch
./0001-Fix-compilation-w-gcc9.patch
];
postPatch = ''
sed -i -e 's/Args.hasArg(options::OPT_nostdlibinc)/true/' lib/Driver/Tools.cpp