aboutsummaryrefslogtreecommitdiffstats
path: root/community/vlc/vlc-2.2.4-gcc6_fixes-1.patch
blob: 68229a0963c9116ebc1f94bfa7ec651500595999 (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
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
Submitted By:            Bruce dubbs <bdubbs at gmail dot com>
Date:                    2016-07-27
Initial Package Version: 2.2.7
Upstream Status:         Unknown
Origin:                  https://build.opensuse.org/package/view_file/openSUSE:Factory/vlc/vlc-gcc6-buildfixes.patch
Description:             Fixes building against gcc6

--- vlc-2.2.3.orig/include/vlc_atomic.h
+++ vlc-2.2.3/include/vlc_atomic.h
@@ -26,13 +26,20 @@
  * Atomic operations do not require locking, but they are not very powerful.
  */
 
-# if !defined (__cplusplus) && (__STDC_VERSION__ >= 201112L) \
-  && !defined (__STDC_NO_ATOMICS__)
+/* Clang older versions support atomics but lacks the stdatomic.h header */
+#if defined(__clang__)
+# if !defined(__has_include) || !__has_include(<stdatomic.h>)
+#  define __STDC_NO_ATOMICS__ 1
+# endif
+#endif
 
+# ifndef __cplusplus
+#  if (__STDC_VERSION__ >= 201112L) && !defined (__STDC_NO_ATOMICS__)
 /*** Native C11 atomics ***/
-#  include <stdatomic.h>
+#   include <stdatomic.h>
 
-# else
+#  else
+/*** Intel/GCC atomics ***/
 
 #  define ATOMIC_FLAG_INIT false
 
@@ -53,22 +60,6 @@
 #  define atomic_is_lock_free(obj) \
     false
 
-/* In principles, __sync_*() only supports int, long and long long and their
- * unsigned equivalents, i.e. 4-bytes and 8-bytes types, although GCC also
- * supports 1 and 2-bytes types. Some non-x86 architectures do not support
- * 8-byte atomic types (or not efficiently). */
-#  if defined (_MSC_VER)
-/* Some atomic operations of the Interlocked API are only
-   available for desktop apps. Thus we define the atomic types to
-   be at least 32 bits wide. */
-typedef      int_least32_t atomic_flag;
-typedef      int_least32_t atomic_bool;
-typedef      int_least32_t atomic_char;
-typedef      int_least32_t atomic_schar;
-typedef     uint_least32_t atomic_uchar;
-typedef      int_least32_t atomic_short;
-typedef     uint_least32_t atomic_ushort;
-#  else
 typedef          bool      atomic_flag;
 typedef          bool      atomic_bool;
 typedef          char      atomic_char;
@@ -76,7 +67,6 @@ typedef   signed char      atomic_schar;
 typedef unsigned char      atomic_uchar;
 typedef          short     atomic_short;
 typedef unsigned short     atomic_ushort;
-#  endif
 typedef          int       atomic_int;
 typedef unsigned int       atomic_uint;
 typedef          long      atomic_long;
@@ -109,10 +99,6 @@ typedef         ptrdiff_t atomic_ptrdiff
 typedef          intmax_t atomic_intmax_t;
 typedef         uintmax_t atomic_uintmax_t;
 
-# if defined (__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) || (defined (__clang__) && (defined (__x86_64__) || defined (__i386__)))
-
-/*** Intel/GCC atomics ***/
-
 #  define atomic_store(object,desired) \
     do { \
         *(object) = (desired); \
@@ -203,204 +189,7 @@ typedef         uintmax_t atomic_uintmax
 #  define atomic_flag_clear_explicit(object,order) \
     atomic_flag_clear(object)
 
-# elif defined (__GNUC__)
-
-/*** No atomics ***/
-
-#  define atomic_store(object,desired) \
-    do { \
-        typeof (object) _obj = (object); \
-        typeof (*object) _des = (desired); \
-        vlc_global_lock(VLC_ATOMIC_MUTEX); \
-        *_obj = _des; \
-        vlc_global_unlock(VLC_ATOMIC_MUTEX); \
-    } while (0)
-#  define atomic_store_explicit(object,desired,order) \
-    atomic_store(object,desired)
-
-#  define atomic_load(object) \
-({ \
-    typeof (object) _obj = (object); \
-    typeof (*object) _old; \
-    vlc_global_lock(VLC_ATOMIC_MUTEX); \
-    _old = *_obj; \
-    vlc_global_unlock(VLC_ATOMIC_MUTEX); \
-    _old; \
-})
-#  define atomic_load_explicit(object,order) \
-    atomic_load(object)
-
-#  define atomic_exchange(object,desired) \
-({ \
-    typeof (object) _obj = (object); \
-    typeof (*object) _des = (desired); \
-    typeof (*object) _old; \
-    vlc_global_lock(VLC_ATOMIC_MUTEX); \
-    _old = *_obj; \
-    *_obj = _des; \
-    vlc_global_unlock(VLC_ATOMIC_MUTEX); \
-    _old; \
-})
-#  define atomic_exchange_explicit(object,desired,order) \
-    atomic_exchange(object,desired)
-
-#  define atomic_compare_exchange_strong(object,expected,desired) \
-({ \
-    typeof (object) _obj = (object); \
-    typeof (object) _exp = (expected); \
-    typeof (*object) _des = (desired); \
-    bool ret; \
-    vlc_global_lock(VLC_ATOMIC_MUTEX); \
-    ret = *_obj == *_exp; \
-    if (ret) \
-        *_obj = _des; \
-    else \
-        *_exp = *_obj; \
-    vlc_global_unlock(VLC_ATOMIC_MUTEX); \
-    ret; \
-})
-#  define atomic_compare_exchange_strong_explicit(object,expected,desired,order) \
-    atomic_compare_exchange_strong(object, expected, desired)
-#  define atomic_compare_exchange_weak(object,expected,desired) \
-    atomic_compare_exchange_strong(object, expected, desired)
-#  define atomic_compare_exchange_weak_explicit(object,expected,desired,order) \
-    atomic_compare_exchange_weak(object, expected, desired)
-
-#  define atomic_fetch_OP(object,desired,op) \
-({ \
-    typeof (object) _obj = (object); \
-    typeof (*object) _des = (desired); \
-    typeof (*object) _old; \
-    vlc_global_lock(VLC_ATOMIC_MUTEX); \
-    _old = *_obj; \
-    *_obj = (*_obj) op (_des); \
-    vlc_global_unlock(VLC_ATOMIC_MUTEX); \
-    _old; \
-})
-
-#  define atomic_fetch_add(object,operand) \
-    atomic_fetch_OP(object,operand,+)
-#  define atomic_fetch_add_explicit(object,operand,order) \
-    atomic_fetch_add(object,operand)
-
-#  define atomic_fetch_sub(object,operand) \
-    atomic_fetch_OP(object,operand,-)
-#  define atomic_fetch_sub_explicit(object,operand,order) \
-    atomic_fetch_sub(object,operand)
-
-#  define atomic_fetch_or(object,operand) \
-    atomic_fetch_OP(object,operand,|)
-#  define atomic_fetch_or_explicit(object,operand,order) \
-    atomic_fetch_or(object,operand)
-
-#  define atomic_fetch_xor(object,operand) \
-    atomic_fetch_OP(object,operand,^)
-#  define atomic_fetch_xor_explicit(object,operand,order) \
-    atomic_fetch_sub(object,operand)
-
-#  define atomic_fetch_and(object,operand) \
-    atomic_fetch_OP(object,operand,&)
-#  define atomic_fetch_and_explicit(object,operand,order) \
-    atomic_fetch_and(object,operand)
-
-#  define atomic_flag_test_and_set(object) \
-    atomic_exchange(object, true)
-
-#  define atomic_flag_test_and_set_explicit(object,order) \
-    atomic_flag_test_and_set(object)
-
-#  define atomic_flag_clear(object) \
-    atomic_store(object, false)
-
-#  define atomic_flag_clear_explicit(object,order) \
-    atomic_flag_clear(object)
-
-# elif defined (_MSC_VER)
-
-# include <windows.h>
-
-/*** Use the Interlocked API. ***/
-
-/* Define macros in order to dispatch to the correct function depending on the type.
-   Several ranges are need because some operations are not implemented for all types. */
-#  define atomic_type_dispatch_32_64(operation, object, ...) \
-    (sizeof(*object) == 4 ? operation((LONG *)object, __VA_ARGS__) : \
-    sizeof(*object) == 8 ? operation##64((LONGLONG *)object, __VA_ARGS__) : \
-    (abort(), 0))
-
-#  define atomic_type_dispatch_16_64(operation, object, ...) \
-    (sizeof(*object) == 2 ? operation##16((short *)object, __VA_ARGS__) : \
-    atomic_type_dispatch_32_64(operation, object, __VA_ARGS__))
-
-#  define atomic_type_dispatch_8_64(operation, object, ...) \
-    (sizeof(*object) == 1 ? operation##8((char *)object, __VA_ARGS__) : \
-    atomic_type_dispatch_16_64(operation, object, __VA_ARGS__))
-
-#  define atomic_store(object,desired) \
-    atomic_type_dispatch_16_64(InterlockedExchange, object, desired)
-#  define atomic_store_explicit(object,desired,order) \
-    atomic_store(object, desired)
-
-#  define atomic_load(object) \
-    atomic_type_dispatch_16_64(InterlockedCompareExchange, object, 0, 0)
-#  define atomic_load_explicit(object,order) \
-    atomic_load(object)
-
-#  define atomic_exchange(object,desired) \
-    atomic_type_dispatch_16_64(InterlockedExchange, object, desired)
-#  define atomic_exchange_explicit(object,desired,order) \
-    atomic_exchange(object, desired)
-
-#  define atomic_compare_exchange_strong(object,expected,desired) \
-    atomic_type_dispatch_16_64(InterlockedCompareExchange, object, *expected, desired) == *expected
-#  define atomic_compare_exchange_strong_explicit(object,expected,desired,order) \
-    atomic_compare_exchange_strong(object, expected, desired)
-#  define atomic_compare_exchange_weak(object,expected,desired) \
-    atomic_compare_exchange_strong(object, expected, desired)
-#  define atomic_compare_exchange_weak_explicit(object,expected,desired,order) \
-    atomic_compare_exchange_weak(object, expected, desired)
-
-#  define atomic_fetch_add(object,operand) \
-    atomic_type_dispatch_32_64(InterlockedExchangeAdd, object, operand)
-#  define atomic_fetch_add_explicit(object,operand,order) \
-    atomic_fetch_add(object, operand)
-
-#  define atomic_fetch_sub(object,operand) \
-    atomic_type_dispatch_32_64(InterlockedExchangeAdd, object, -(LONGLONG)operand)
-#  define atomic_fetch_sub_explicit(object,operand,order) \
-    atomic_fetch_sub(object, operand)
-
-#  define atomic_fetch_or(object,operand) \
-    atomic_type_dispatch_8_64(InterlockedOr, object, operand)
-#  define atomic_fetch_or_explicit(object,operand,order) \
-    atomic_fetch_or(object, operand)
-
-#  define atomic_fetch_xor(object,operand) \
-    atomic_type_dispatch_8_64(InterlockedXor, object, operand)
-#  define atomic_fetch_xor_explicit(object,operand,order) \
-    atomic_fetch_sub(object, operand)
-
-#  define atomic_fetch_and(object,operand) \
-    atomic_type_dispatch_8_64(InterlockedAnd, object, operand)
-#  define atomic_fetch_and_explicit(object,operand,order) \
-    atomic_fetch_and(object, operand)
-
-#  define atomic_flag_test_and_set(object) \
-    atomic_exchange(object, true)
-
-#  define atomic_flag_test_and_set_explicit(object,order) \
-    atomic_flag_test_and_set(object)
-
-#  define atomic_flag_clear(object) \
-    atomic_store(object, false)
-
-#  define atomic_flag_clear_explicit(object,order) \
-    atomic_flag_clear(object)
-
-# else
-#  error FIXME: implement atomic operations for this compiler.
-# endif
-# endif
+# endif /* !C11 */
 
 typedef atomic_uint_least32_t vlc_atomic_float;
 
@@ -427,4 +216,9 @@ static inline void vlc_atomic_store_floa
     atomic_store(atom, u.i);
 }
 
+# else /* C++ */
+/*** Native C++11 atomics ***/
+#   include <atomic>
+# endif /* C++ */
+
 #endif
Index: vlc-2.2.3/include/vlc_spu.h
===================================================================
--- vlc-2.2.3.orig/include/vlc_spu.h
+++ vlc-2.2.3/include/vlc_spu.h
@@ -45,9 +45,6 @@ extern "C" {
 
 typedef struct spu_private_t spu_private_t;
 
-/* Default subpicture channel ID */
-#define SPU_DEFAULT_CHANNEL (1)
-
 /**
  * Subpicture unit descriptor
  */
Index: vlc-2.2.3/include/vlc_vout_osd.h
===================================================================
--- vlc-2.2.3.orig/include/vlc_vout_osd.h
+++ vlc-2.2.3/include/vlc_vout_osd.h
@@ -26,12 +26,13 @@
 #ifndef VLC_VOUT_OSD_H
 #define VLC_VOUT_OSD_H 1
 
-#include <vlc_spu.h>
-
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+//* Default subpicture channel ID */
+#define SPU_DEFAULT_CHANNEL (1)
+
 /**
  * OSD menu position and picture type defines
  */
Index: vlc-2.2.3/src/video_output/video_output.c
===================================================================
--- vlc-2.2.3.orig/src/video_output/video_output.c
+++ vlc-2.2.3/src/video_output/video_output.c
@@ -43,6 +43,7 @@
 #include <vlc_vout.h>
 
 #include <vlc_filter.h>
+#include <vlc_spu.h>
 #include <vlc_vout_osd.h>
 #include <vlc_image.h>
 
Index: vlc-2.2.3/modules/gui/qt4/dialogs/messages.hpp
===================================================================
--- vlc-2.2.3.orig/modules/gui/qt4/dialogs/messages.hpp
+++ vlc-2.2.3/modules/gui/qt4/dialogs/messages.hpp
@@ -28,8 +28,8 @@
 #include "util/singleton.hpp"
 #include "ui/messages_panel.h"
 #include <stdarg.h>
-#include <vlc_atomic.h>
 #include <QMutex>
+#include <QAtomicInt>
 
 class QTabWidget;
 class QPushButton;
@@ -55,7 +55,7 @@ private:
     void sinkMessage( const MsgEvent * );
     bool matchFilter( const QString& );
 
-    atomic_uint verbosity;
+    QAtomicInt verbosity;
     static void MsgCallback( void *, int, const vlc_log_t *, const char *,
                              va_list );
 
Index: vlc-2.2.3/modules/gui/qt4/dialogs/messages.cpp
===================================================================
--- vlc-2.2.3.orig/modules/gui/qt4/dialogs/messages.cpp
+++ vlc-2.2.3/modules/gui/qt4/dialogs/messages.cpp
@@ -143,7 +143,7 @@ MessagesDialog::~MessagesDialog()
 
 void MessagesDialog::changeVerbosity( int i_verbosity )
 {
-    atomic_store( &this->verbosity, i_verbosity );
+    verbosity = i_verbosity;
 }
 
 void MessagesDialog::updateConfig()
@@ -337,7 +337,7 @@ void MessagesDialog::MsgCallback( void *
 {
     MessagesDialog *dialog = (MessagesDialog *)self;
     char *str;
-    int verbosity = atomic_load( &dialog->verbosity );
+    int verbosity = dialog->verbosity;
 
     if( verbosity < 0 || verbosity < (type - VLC_MSG_ERR)
      || unlikely(vasprintf( &str, format, ap ) == -1) )

--- vlc-2.2.4.orig/modules/video_filter/atmo/atmo.cpp	2016-05-31 18:11:08.000000000 +0200
+++ vlc-2.2.4/modules/video_filter/atmo/atmo.cpp	2016-09-13 21:15:07.930984954 +0200
@@ -696,7 +696,7 @@
 {
     filter_t *p_filter;
     vlc_thread_t thread;
-    atomic_bool abort;
+    std::atomic_bool abort;
 
     /* tell the thread which color should be the target of fading */
     uint8_t ui_red;