1 From 38493fceb39ac33e12c9c69d78f5584413b479f4 Mon Sep 17 00:00:00 2001
2 From: Bernd Kuhls <bernd.kuhls@t-online.de>
3 Date: Wed, 1 Mar 2017 10:03:40 +0100
4 Subject: [PATCH] Various fixes to compile libsidplay2 with newer gcc compilers
7 http://tsubasa.googlecode.com/svn/trunk/tsubasa/sidplay2-libs/sidplay2-libs-2.1.1.diff
9 Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
10 [Thomas: adjusted to avoid the need to autoreconf, which doesn't work
11 properly on this package.]
12 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
14 builders/hardsid-builder/src/hardsid-builder.cpp | 1 +
15 builders/resid-builder/src/resid-builder.cpp | 1 +
16 builders/resid-builder/src/resid.cpp | 1 +
18 libsidplay/configure | 5 +++--
19 libsidplay/include/sidplay/SmartPtr.h | 28 ++++++++++++------------
20 libsidplay/include/sidplay/sidendian.h | 18 +++++++++------
21 libsidutils/include/sidplay/utils/SidUsage.h | 2 +-
22 8 files changed, 33 insertions(+), 25 deletions(-)
24 diff --git a/builders/hardsid-builder/src/hardsid-builder.cpp b/builders/hardsid-builder/src/hardsid-builder.cpp
25 index f54d0a9..9375e40 100644
26 --- a/builders/hardsid-builder/src/hardsid-builder.cpp
27 +++ b/builders/hardsid-builder/src/hardsid-builder.cpp
29 ***************************************************************************/
35 #ifdef HAVE_EXCEPTIONS
36 diff --git a/builders/resid-builder/src/resid-builder.cpp b/builders/resid-builder/src/resid-builder.cpp
37 index e6e4eaa..4c7650f 100644
38 --- a/builders/resid-builder/src/resid-builder.cpp
39 +++ b/builders/resid-builder/src/resid-builder.cpp
41 ***************************************************************************/
47 #ifdef HAVE_EXCEPTIONS
48 diff --git a/builders/resid-builder/src/resid.cpp b/builders/resid-builder/src/resid.cpp
49 index 8c27850..d3123c5 100644
50 --- a/builders/resid-builder/src/resid.cpp
51 +++ b/builders/resid-builder/src/resid.cpp
54 ***************************************************************************/
59 #ifdef HAVE_EXCEPTIONS
60 diff --git a/configure b/configure
61 index 1200eaf..77948b4 100755
64 @@ -1227,7 +1227,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
68 -builders='${libdir}'/sidplay/builders
69 +builders='${libdir}'/
70 ac_configure_args="$ac_configure_args --disable-library-checks"
73 diff --git a/libsidplay/configure b/libsidplay/configure
74 index 05a8ea6..3d93956 100755
75 --- a/libsidplay/configure
76 +++ b/libsidplay/configure
77 @@ -23466,8 +23466,9 @@ _ACEOF
78 cat confdefs.h >>conftest.$ac_ext
79 cat >>conftest.$ac_ext <<_ACEOF
82 - #include <iomanip.h>
85 + using namespace std;
89 diff --git a/libsidplay/include/sidplay/SmartPtr.h b/libsidplay/include/sidplay/SmartPtr.h
90 index c0cbb1a..15efd10 100644
91 --- a/libsidplay/include/sidplay/SmartPtr.h
92 +++ b/libsidplay/include/sidplay/SmartPtr.h
93 @@ -17,16 +17,16 @@ class SmartPtrBase_sidtt
97 - pBufCurrent = ( bufBegin = buffer );
98 - bufEnd = bufBegin + bufferLen;
101 + this->pBufCurrent = ( this->bufBegin = buffer );
102 + this->bufEnd = this->bufBegin + bufferLen;
103 + this->bufLen = bufferLen;
104 + this->status = true;
108 - pBufCurrent = ( bufBegin = ( bufEnd = 0 ));
111 + this->pBufCurrent = ( this->bufBegin = ( this->bufEnd = 0 ));
113 + this->status = false;
117 @@ -211,16 +211,16 @@ class SmartPtr_sidtt : public SmartPtrBase_sidtt<T>
119 if ( bufferLen >= 1 )
121 - pBufCurrent = ( bufBegin = buffer );
122 - bufEnd = bufBegin + bufferLen;
123 - bufLen = bufferLen;
125 + this->pBufCurrent = ( this->bufBegin = buffer );
126 + this->bufEnd = this->bufBegin + bufferLen;
127 + this->bufLen = bufferLen;
128 + this->status = true;
132 - pBufCurrent = bufBegin = bufEnd = 0;
135 + this->pBufCurrent = this->bufBegin = this->bufEnd = 0;
137 + this->status = false;
141 diff --git a/libsidplay/include/sidplay/sidendian.h b/libsidplay/include/sidplay/sidendian.h
142 index 9fa8582..6115282 100644
143 --- a/libsidplay/include/sidplay/sidendian.h
144 +++ b/libsidplay/include/sidplay/sidendian.h
146 ***************************************************************************/
147 /***************************************************************************
148 * $Log: sidendian.h,v $
149 + * Revision 1.6 2005/11/20 11:02:06 s_a_white
150 + * Work around for bug in gcc 4 (optimiser breaks if variable never has a
151 + * direct assignment).
153 * Revision 1.5 2001/07/03 22:44:13 s_a_white
154 * Added endian_16 to convert a 16 bit value to an array of 8s.
156 @@ -141,7 +145,7 @@ inline void endian_16swap8 (uint_least16_t &word)
157 // Convert high-byte and low-byte to 16-bit word.
158 inline uint_least16_t endian_16 (uint8_t hi, uint8_t lo)
160 - uint_least16_t word;
161 + uint_least16_t word = 0;
162 endian_16lo8 (word, lo);
163 endian_16hi8 (word, hi);
165 @@ -165,7 +169,7 @@ inline void endian_16 (uint8_t ptr[2], uint_least16_t word)
167 inline void endian_16 (char ptr[2], uint_least16_t word)
169 - endian_16 ((uint8_t *) ptr, word);
170 + endian_16 ((uint8_t *) ptr, word);
173 // Convert high-byte and low-byte to 16-bit little endian word.
174 @@ -334,7 +338,7 @@ inline void endian_32swap16 (uint_least32_t &dword)
176 inline void endian_32swap8 (uint_least32_t &dword)
178 - uint_least16_t lo, hi;
179 + uint_least16_t lo = 0, hi = 0;
180 lo = endian_32lo16 (dword);
181 hi = endian_32hi16 (dword);
183 @@ -346,8 +350,8 @@ inline void endian_32swap8 (uint_least32_t &dword)
184 // Convert high-byte and low-byte to 32-bit word.
185 inline uint_least32_t endian_32 (uint8_t hihi, uint8_t hilo, uint8_t hi, uint8_t lo)
187 - uint_least32_t dword;
188 - uint_least16_t word;
189 + uint_least32_t dword = 0;
190 + uint_least16_t word = 0;
191 endian_32lo8 (dword, lo);
192 endian_32hi8 (dword, hi);
193 endian_16lo8 (word, hilo);
194 @@ -374,7 +378,7 @@ inline void endian_little32 (uint8_t ptr[4], uint_least32_t dword)
195 defined(SID_WORDS_LITTLEENDIAN)
196 *((uint_least32_t *) ptr) = dword;
198 - uint_least16_t word;
199 + uint_least16_t word = 0;
200 ptr[0] = endian_32lo8 (dword);
201 ptr[1] = endian_32hi8 (dword);
202 word = endian_32hi16 (dword);
203 @@ -401,7 +405,7 @@ inline void endian_big32 (uint8_t ptr[4], uint_least32_t dword)
204 defined(SID_WORDS_BIGENDIAN)
205 *((uint_least32_t *) ptr) = dword;
207 - uint_least16_t word;
208 + uint_least16_t word = 0;
209 word = endian_32hi16 (dword);
210 ptr[1] = endian_16lo8 (word);
211 ptr[0] = endian_16hi8 (word);
212 diff --git a/libsidutils/include/sidplay/utils/SidUsage.h b/libsidutils/include/sidplay/utils/SidUsage.h
213 index 2afb0f3..0496eea 100755
214 --- a/libsidutils/include/sidplay/utils/SidUsage.h
215 +++ b/libsidutils/include/sidplay/utils/SidUsage.h
216 @@ -33,7 +33,7 @@ struct sid2_usage_t: public sid_usage_t
217 uint_least16_t length; // usage scan length
219 // Copy common parts of basic usage to extended usage.
220 - sid2_usage_t &sid2_usage_t::operator= (const sid_usage_t &usage)
221 + sid2_usage_t &operator= (const sid_usage_t &usage)
223 *((sid_usage_t *) this) = usage;