Package: netsurf / 3.6-3.2

Build-Include-gperf-generated-code-directly.patch Patch series | download
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
88
89
90
91
92
From: Michael Drake <michael.drake@codethink.co.uk>
Date: Thu, 20 Apr 2017 09:51:07 +0000
Subject: [PATCH] Build: Include gperf-generated code directly.

Previously we built the generated code separatly and then linked to
it.  However, this caused problems with certain compilers and gperf
versions.  This change includes the generated code directly in
svgtiny.c instead, which is the only place its used.

Source: http://source.netsurf-browser.org/libsvgtiny.git/commit/?id=4390f1c84e8fee51fc22468821e6fc158e783053
---
 libsvgtiny/src/Makefile           | 13 +++++++------
 libsvgtiny/src/colors.gperf       |  8 --------
 libsvgtiny/src/svgtiny.c          |  3 +++
 libsvgtiny/src/svgtiny_internal.h |  5 -----
 4 files changed, 10 insertions(+), 19 deletions(-)

diff --git a/libsvgtiny/src/Makefile b/libsvgtiny/src/Makefile
index a97972023257..fb8a72f9c2ff 100644
--- a/libsvgtiny/src/Makefile
+++ b/libsvgtiny/src/Makefile
@@ -1,13 +1,14 @@
 # Sources
 DIR_SOURCES := svgtiny.c svgtiny_gradient.c svgtiny_list.c
 
-SOURCES := $(SOURCES) $(BUILDDIR)/src_colors.c
+SOURCES := $(SOURCES)
 
-$(BUILDDIR)/src_colors.c: src/colors.gperf
+$(DIR)autogenerated_colors.c: src/colors.gperf
 	$(VQ)$(ECHO) "   GPERF: $<"
-	$(Q)gperf --output-file=$@.tmp $<
-# Hack for GCC 4.2 compatibility (gperf 3.0.4 solves this properly)
-	$(Q)$(SED) -e 's/#ifdef __GNUC_STDC_INLINE__/#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__/' $@.tmp >$@
-	$(Q)$(RM) $@.tmp
+	$(Q)gperf --output-file=$@ $<
+
+PRE_TARGETS := $(DIR)autogenerated_colors.c
+
+CLEAN_ITEMS := $(DIR)autogenerated_colors.c
 
 include $(NSBUILD)/Makefile.subdir
diff --git a/libsvgtiny/src/colors.gperf b/libsvgtiny/src/colors.gperf
index 96d5b9e5debf..a836787bf306 100644
--- a/libsvgtiny/src/colors.gperf
+++ b/libsvgtiny/src/colors.gperf
@@ -17,14 +17,6 @@
 #include "svgtiny.h"
 #include "svgtiny_internal.h"
 
-/* This unusual define shennanigan is to try and prevent the gperf
- * generated function from being inlined.  This is pointless given
- * it (a) is in a separate .c file and (b) has external linkage.
- */
-#ifdef __inline
-#undef __inline
-#define __inline
-#endif
 %}
 
 struct svgtiny_named_color;
diff --git a/libsvgtiny/src/svgtiny.c b/libsvgtiny/src/svgtiny.c
index 4661a58a2dff..bbefb888a263 100644
--- a/libsvgtiny/src/svgtiny.c
+++ b/libsvgtiny/src/svgtiny.c
@@ -20,6 +20,9 @@
 #include "svgtiny.h"
 #include "svgtiny_internal.h"
 
+/* Source file generated by `gperf`. */
+#include "autogenerated_colors.c"
+
 #ifndef M_PI
 #define M_PI		3.14159265358979323846
 #endif
diff --git a/libsvgtiny/src/svgtiny_internal.h b/libsvgtiny/src/svgtiny_internal.h
index 158d23059c60..6bf5d64d9927 100644
--- a/libsvgtiny/src/svgtiny_internal.h
+++ b/libsvgtiny/src/svgtiny_internal.h
@@ -102,9 +102,4 @@ void *svgtiny_list_get(struct svgtiny_list *list,
 void *svgtiny_list_push(struct svgtiny_list *list);
 void svgtiny_list_free(struct svgtiny_list *list);
 
-/* colors.gperf */
-const struct svgtiny_named_color *
-		svgtiny_color_lookup(register const char *str,
-				register unsigned int len);
-
 #endif
-- 
2.18.0