<html><head></head><body>Hi,<br><br>The TC is tentatively leaning toward having an ifdef on the clang version to solve this without affecting GCC and newer Clang. It would be appreciated of you could update your patch accordingly.<br><br><div class="gmail_quote">Le 24 février 2020 16:45:07 GMT+01:00, Marvin Scholz <epirat07@gmail.com> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">According to the standard, C11's atomic_load_explicit did not allow<br>a const qualified first argument, even though it never modifies it.<br>Clang versions 7 or older did implement this quite strictly and<br>therefore errors when compiling this code:<br><br>  address argument to atomic operation must be a pointer to non-const<br>  _Atomic type ('const _Atomic(const void *) *' invalid)<br><br>See <a href="https://reviews.llvm.org/D47618">https://reviews.llvm.org/D47618</a> and <a href="https://reviews.llvm.org/D47613">https://reviews.llvm.org/D47613</a><br><br>C-standard wise this is fixed in C17, see DR459<br><a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_459">http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_459</a><hr> src/misc/threads.c | 9 ++++++++-<br> 1 file changed, 8 insertions(+), 1 deletion(-)<br><br>diff --git a/src/misc/threads.c b/src/misc/threads.c<br>index ea78e37453..6f5255505f 100644<br>--- a/src/misc/threads.c<br>+++ b/src/misc/threads.c<br>@@ -139,7 +139,14 @@ bool vlc_mutex_held(const vlc_mutex_t *mtx)<br>      * Even though other threads may modify the owner field at any time,<br>      * they will never make it compare equal to the calling thread.<br>      */<br>-    return THREAD_SELF == atomic_load_explicit(&mtx->owner,<br>+<br>+    /* The explicit cast to non-const is needed to workaround a clang<br>+     * error with clang 7 or lower, as atomic_load_explicit in C11 does not<br>+     * allow its first argument to be const-qualified, and clang implmented<br>+     * this like that.<br>+     * This is fixed in clang version 8 or newer, and in the C17 standard.<br>+     */<br>+    return THREAD_SELF == atomic_load_explicit(&((vlc_mutex_t *)mtx)->owner,<br>                                                memory_order_relaxed);<br> }<br> </pre></blockquote></div><br>-- <br>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.</body></html>