summaryrefslogtreecommitdiff
blob: 4f51f72deb1e0fd7ac7a9a96c759e2d886974463 (plain)
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
https://bugs.gentoo.org/859847

From 8c6f6bf3ad2fd33d15de6ee96175cd29bf804d9f Mon Sep 17 00:00:00 2001
From: Matt Turner <mattst88@gmail.com>
Date: Tue, 26 Jul 2022 15:47:02 -0400
Subject: [PATCH] Fix aliasing violation
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Noticed when compiling with link-time optimizations.

include/GL/freeglut_std.h:240:18: error: type of `glutBitmapHelvetica18` does not match original declaration [-Werror=lto-type-mismatch]
  240 |     extern void* glutBitmapHelvetica18;
      |                  ^
src/x11/fg_glutfont_definitions_x11.c:103:27: note: `glutBitmapHelvetica18` was previously declared here
  103 | struct freeglutBitmapFont glutBitmapHelvetica18 ;
      |                           ^
src/x11/fg_glutfont_definitions_x11.c:103:27: note: code may be misoptimized unless `-fno-strict-aliasing` is used
---
 src/x11/fg_glutfont_definitions_x11.c | 29 ++++++++++++++++++---------
 1 file changed, 20 insertions(+), 9 deletions(-)

--- a/thirdparty/freeglut/src/x11/fg_glutfont_definitions_x11.c
+++ b/thirdparty/freeglut/src/x11/fg_glutfont_definitions_x11.c
@@ -91,14 +91,25 @@ struct freeglutBitmapFont
 };
 
 
-struct freeglutStrokeFont glutStrokeRoman ;
-struct freeglutStrokeFont glutStrokeMonoRoman ;
+static struct freeglutStrokeFont glutStrokeRoman_ ;
+static struct freeglutStrokeFont glutStrokeMonoRoman_ ;
 
-struct freeglutBitmapFont glutBitmap9By15 ;
-struct freeglutBitmapFont glutBitmap8By13 ;
-struct freeglutBitmapFont glutBitmapTimesRoman10 ;
-struct freeglutBitmapFont glutBitmapTimesRoman24 ;
-struct freeglutBitmapFont glutBitmapHelvetica10 ;
-struct freeglutBitmapFont glutBitmapHelvetica12 ;
-struct freeglutBitmapFont glutBitmapHelvetica18 ;
+static struct freeglutBitmapFont glutBitmap9By15_ ;
+static struct freeglutBitmapFont glutBitmap8By13_ ;
+static struct freeglutBitmapFont glutBitmapTimesRoman10_ ;
+static struct freeglutBitmapFont glutBitmapTimesRoman24_ ;
+static struct freeglutBitmapFont glutBitmapHelvetica10_ ;
+static struct freeglutBitmapFont glutBitmapHelvetica12_ ;
+static struct freeglutBitmapFont glutBitmapHelvetica18_ ;
 
+
+void *glutStrokeRoman = &glutStrokeRoman_ ;
+void *glutStrokeMonoRoman = &glutStrokeMonoRoman_ ;
+
+void *glutBitmap9By15 = &glutBitmap9By15_ ;
+void *glutBitmap8By13 = &glutBitmap8By13_ ;
+void *glutBitmapTimesRoman10 = &glutBitmapTimesRoman10_ ;
+void *glutBitmapTimesRoman24 = &glutBitmapTimesRoman24_ ;
+void *glutBitmapHelvetica10 = &glutBitmapHelvetica10_ ;
+void *glutBitmapHelvetica12 = &glutBitmapHelvetica12_ ;
+void *glutBitmapHelvetica18 = &glutBitmapHelvetica18_ ;
-- 
2.35.1