about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/compilers/llvm/3.9/clang/0001-Fix-compilation-w-gcc9.patch
blob: 1058cd03176720ec98ce3d3ad97ba89ec5ea2820 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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