all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
blob 6da4179a9e7f053487193cd527efa3ddca473fcb 2987 bytes (raw)
name: gnu/packages/patches/ericw-tools-gcc-11-pass-const-to-offsetof.patch 	 # note: path name is non-authoritative(*)

 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
 
From c9570260fa895dde5a21272d76f9a3b05d59efdd Mon Sep 17 00:00:00 2001
From: Eric Wasylishen <ewasylishen@gmail.com>
Date: Sun, 30 May 2021 23:12:17 -0600
Subject: [PATCH] gcc 11: pass constant to offsetof

---
 common/polylib.cc |  5 ++++-
 qbsp/util.cc      |  5 ++++-
 qbsp/winding.cc   |  4 +++-
 vis/vis.cc        | 10 ++++++++--
 4 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/common/polylib.cc b/common/polylib.cc
index 6397b3107..c8e1afbff 100644
--- a/common/polylib.cc
+++ b/common/polylib.cc
@@ -230,7 +230,10 @@ polylib::CopyWinding(const winding_t * w)
     int size;
     winding_t *c;
 
-    size = offsetof(winding_t, p[w->numpoints]);
+    //size = offsetof(winding_t, p[w->numpoints]);
+    size = offsetof(winding_t, p[0]);
+    size += w->numpoints * sizeof(w->p[0]);
+
     c = static_cast<winding_t *>(malloc(size));
     memcpy(c, w, size);
     return c;
diff --git a/qbsp/util.cc b/qbsp/util.cc
index e8baf7205..16c9077f1 100644
--- a/qbsp/util.cc
+++ b/qbsp/util.cc
@@ -53,7 +53,10 @@ AllocMem(int Type, int cElements, bool fZero)
         if (cElements > MAX_POINTS_ON_WINDING)
             Error("Too many points (%d) on winding (%s)", cElements, __func__);
 
-        cSize = offsetof(winding_t, points[cElements]) + sizeof(int);
+        //cSize = offsetof(winding_t, points[cElements]) + sizeof(int);
+        cSize = offsetof(winding_t, points[0]);
+        cSize += cElements * sizeof(static_cast<winding_t*>(nullptr)->points[0]);
+        cSize += sizeof(int);
 
         // Set cElements to 1 so bookkeeping works OK
         cElements = 1;
diff --git a/qbsp/winding.cc b/qbsp/winding.cc
index 1af1d096c..6e286c387 100644
--- a/qbsp/winding.cc
+++ b/qbsp/winding.cc
@@ -106,7 +106,9 @@ CopyWinding(const winding_t *w)
     winding_t *c;
 
     c = (winding_t *)AllocMem(WINDING, w->numpoints, false);
-    size = offsetof(winding_t, points[w->numpoints]);
+    //size = offsetof(winding_t, points[w->numpoints]);
+    size = offsetof(winding_t, points[0]);
+    size += w->numpoints * sizeof(w->points[0]);
     memcpy(c, w, size);
 
     return c;
diff --git a/vis/vis.cc b/vis/vis.cc
index 9fb0ea9ea..ec43a8a5f 100644
--- a/vis/vis.cc
+++ b/vis/vis.cc
@@ -127,7 +127,10 @@ NewWinding(int points)
     if (points > MAX_WINDING)
         Error("%s: %i points", __func__, points);
 
-    size = offsetof(winding_t, points[points]);
+    //size = offsetof(winding_t, points[points]);
+    size = offsetof(winding_t, points[0]);
+    size += points * sizeof(w->points[0]);
+
     w = static_cast<winding_t *>(malloc(size));
     memset(w, 0, size);
 
@@ -178,7 +181,10 @@ CopyWinding(const winding_t * w)
     int size;
     winding_t *c;
 
-    size = offsetof(winding_t, points[w->numpoints]);
+    //size = offsetof(winding_t, points[w->numpoints]);
+    size = offsetof(winding_t, points[0]);
+    size += w->numpoints * sizeof(w->points[0]);
+
     c = static_cast<winding_t *>(malloc(size));
     memcpy(c, w, size);
     return c;

debug log:

solving 6da4179a9e ...
found 6da4179a9e in https://yhetil.org/guix/a1ab67515ed40a088f8ae0fe33c1f077d6ff9692.1726879062.git.jsubuntuxp@disroot.org/ ||
	https://yhetil.org/guix/77a59889d3bed9a7629b49da7b033846cb195715.1726445374.git.jsubuntuxp@disroot.org/

applying [1/1] https://yhetil.org/guix/a1ab67515ed40a088f8ae0fe33c1f077d6ff9692.1726879062.git.jsubuntuxp@disroot.org/
diff --git a/gnu/packages/patches/ericw-tools-gcc-11-pass-const-to-offsetof.patch b/gnu/packages/patches/ericw-tools-gcc-11-pass-const-to-offsetof.patch
new file mode 100644
index 0000000000..6da4179a9e

1:26: trailing whitespace.
 
1:42: trailing whitespace.
 
1:48: trailing whitespace.
 
1:57: trailing whitespace.
 
1:64: trailing whitespace.
 
Checking patch gnu/packages/patches/ericw-tools-gcc-11-pass-const-to-offsetof.patch...
Applied patch gnu/packages/patches/ericw-tools-gcc-11-pass-const-to-offsetof.patch cleanly.
warning: squelched 3 whitespace errors
warning: 8 lines add whitespace errors.

skipping https://yhetil.org/guix/77a59889d3bed9a7629b49da7b033846cb195715.1726445374.git.jsubuntuxp@disroot.org/ for 6da4179a9e
index at:
100644 6da4179a9e7f053487193cd527efa3ddca473fcb	gnu/packages/patches/ericw-tools-gcc-11-pass-const-to-offsetof.patch

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.