[vlc-commits] [Git][videolan/vlc][master] 5 commits: configure: also look for a C17 compiler for native builds
Steve Lhomme (@robUx4)
gitlab at videolan.org
Tue Feb 6 10:24:05 UTC 2024
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
1d5d67b7 by Steve Lhomme at 2024-02-06T08:32:48+00:00
configure: also look for a C17 compiler for native builds
- - - - -
b164a2f4 by Steve Lhomme at 2024-02-06T08:32:48+00:00
switch to C17
- - - - -
b57f2c7e by Steve Lhomme at 2024-02-06T08:32:48+00:00
update the minimum gcc/clang version with C17 support
c17 option added in gcc 8: https://gcc.gnu.org/onlinedocs/gcc-8.5.0/gcc/Standards.html
released in 2018: https://gcc.gnu.org/releases.html
c17 officially supported in clang 6: https://clang.llvm.org/c_status.html
released in 2018: https://releases.llvm.org/
- - - - -
9f113f8e by Steve Lhomme at 2024-02-06T08:32:48+00:00
remove deprecated ATOMIC_VAR_INIT() usage
It's deprecated in C17 [1]. Atomic initializers don't need this macro.
Even with std=gnu11, clang 14+ would issue a warning it's deprecated.
[1] https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_485
- - - - -
685ecc6b by Steve Lhomme at 2024-02-06T08:32:48+00:00
threads: remove clang 6/7 hack for const in atomic_loadXXX
We require clang 8 for proper C17 support.
- - - - -
13 changed files:
- NEWS
- configure.ac
- include/vlc_atomic.h
- include/vlc_threads.h
- m4/c11.m4 → m4/c17.m4
- meson.build
- modules/codec/shine.c
- modules/gui/macosx/windows/video/VLCVideoOutputProvider.m
- modules/keystore/secret.c
- src/config/core.c
- src/misc/cpu.c
- src/misc/threads.c
- src/misc/threads.h
Changes:
=====================================
NEWS
=====================================
@@ -7,7 +7,7 @@ Platform support changes:
- macOS 10.11 or later
- iOS 9 or later
- Android 4.1.x or later (API-16)
- - GCC 5.0 or Clang 3.4 (or equivalent)
+ - GCC 8.0 or Clang 8 (or equivalent)
* Windows on ARM is now supported
* Universal Windows is only supported for Windows 10 (not Windows 8 anymore)
=====================================
configure.ac
=====================================
@@ -40,7 +40,7 @@ dnl Check for tools
dnl
AC_PROG_CC
AC_USE_SYSTEM_EXTENSIONS
-VLC_PROG_CC_C11
+VLC_PROG_CC_C17
AH_VERBATIM([FORTIFY_SOURCE],
[/* Enable compile-time and run-time bounds-checking, and some warnings,
without upsetting glibc 2.15+ or toolchains predefining _FORTIFY_SOURCE */
@@ -63,7 +63,7 @@ AC_PROG_YACC
AC_ARG_VAR([DESKTOP_FILE_VALIDATE], [Validator for desktop entry files])
AC_CHECK_PROGS([DESKTOP_FILE_VALIDATE], [${DESKTOP_FILE_VALIDATE} desktop-file-validate], :)
AC_ARG_VAR([BUILDCC], [Build system C11 or C99 compiler command])
-AC_CHECK_PROGS([BUILDCC], [c11-gcc c11 c99-gcc c99], [false])
+AC_CHECK_PROGS([BUILDCC], [c17-gcc c17 c11-gcc c11 c99-gcc c99], [false])
AS_IF([test "$BUILDCC" = "false"], [
AC_MSG_ERROR([Cannot find native C99 compiler: please define BUILDCC.])
])
=====================================
include/vlc_atomic.h
=====================================
@@ -41,7 +41,7 @@ using std::memory_order_acq_rel;
#include <time.h> /* vlc_atomic_timedwait_daytime */
#define VLC_STATIC_RC { \
- .refs = ATOMIC_VAR_INIT(0) \
+ .refs = 0 \
}
typedef struct vlc_atomic_rc_t {
=====================================
include/vlc_threads.h
=====================================
@@ -163,9 +163,9 @@ typedef struct
* In C++, consider using a global ::vlc::threads::mutex instance instead.
*/
#define VLC_STATIC_MUTEX { \
- .value = ATOMIC_VAR_INIT(0), \
- .recursion = ATOMIC_VAR_INIT(0), \
- .owner = ATOMIC_VAR_INIT(0), \
+ .value = 0, \
+ .recursion = 0, \
+ .owner = 0, \
}
/**
@@ -527,7 +527,7 @@ typedef struct
/**
* Static initializer for one-time initialization.
*/
-#define VLC_STATIC_ONCE { ATOMIC_VAR_INIT(0) }
+#define VLC_STATIC_ONCE { 0 }
/**
* Begins a one-time initialization.
=====================================
m4/c11.m4 → m4/c17.m4
=====================================
@@ -1,5 +1,5 @@
# Copyright © 2015 Rémi Denis-Courmont
-# This file (c11.m4) is free software; unlimited permission to
+# This file (c17.m4) is free software; unlimited permission to
# copy and/or distribute it , with or without modifications, as long
# as this notice is preserved.
@@ -9,13 +9,13 @@
# PARTICULAR PURPOSE.
-AC_DEFUN([VLC_PROG_CC_C11], [
+AC_DEFUN([VLC_PROG_CC_C17], [
AC_LANG_ASSERT(C)
- for opt in "" -std=gnu11 -std=c11 -c11
+ for opt in "" -std=gnu17 -std=c17 -c17
do
- cachevar=AS_TR_SH([ax_cv_c_compile_c11_$opt])
- AC_CACHE_CHECK([whether $CC $opt supports C11], [$cachevar], [
+ cachevar=AS_TR_SH([ax_cv_c_compile_c17_$opt])
+ AC_CACHE_CHECK([whether $CC $opt supports C17], [$cachevar], [
CFLAGS_save="$CFLAGS"
CFLAGS="$CFLAGS $opt"
dnl PREPROC is not enough due to CFLAGS usage
@@ -23,10 +23,10 @@ AC_DEFUN([VLC_PROG_CC_C11], [
[#ifndef __STDC_VERSION__
# error Not a C compiler!
#endif
-#if (__STDC_VERSION__ < 201112L)
+#if (__STDC_VERSION__ < 201710L)
# error Too old C compiler!
#endif
-_Static_assert(1, "Not C11!");
+_Static_assert(1, "Not C17!");
const int varname = _Generic(1, int: 1, default: 0);
]])], [
eval $cachevar="yes"
=====================================
meson.build
=====================================
@@ -1,6 +1,6 @@
project('VLC', ['c', 'cpp'],
version: '4.0.0-dev',
- default_options: ['c_std=gnu11', 'cpp_std=c++17'],
+ default_options: ['c_std=gnu17', 'cpp_std=c++17'],
meson_version: '>=0.60.0')
vlc_copyright_years = '1996-2018'
=====================================
modules/codec/shine.c
=====================================
@@ -67,7 +67,7 @@ vlc_module_begin()
set_callback( OpenEncoder )
vlc_module_end()
-static atomic_bool busy = ATOMIC_VAR_INIT(false);
+static atomic_bool busy = false;
static int OpenEncoder( vlc_object_t *p_this )
{
=====================================
modules/gui/macosx/windows/video/VLCVideoOutputProvider.m
=====================================
@@ -151,7 +151,7 @@ static void WindowUnsetFullscreen(vlc_window_t *wnd)
WindowSetFullscreen(wnd, &windowed);
}
-static atomic_bool b_intf_starting = ATOMIC_VAR_INIT(false);
+static atomic_bool b_intf_starting = false;
static const struct vlc_window_operations ops = {
WindowEnable,
=====================================
modules/keystore/secret.c
=====================================
@@ -300,7 +300,7 @@ check_service_running(void)
/* Cache the return of this function that may take up to 200ms. This atomic
* doesn't prevent a cache miss (unlikely). This function can be called
* safely from any threads. */
- static atomic_int cache_running = ATOMIC_VAR_INIT(0);
+ static atomic_int cache_running = 0;
int running = atomic_load_explicit(&cache_running, memory_order_relaxed);
if (running != 0)
return running == 1 ? VLC_SUCCESS : VLC_EGENERIC;
=====================================
src/config/core.c
=====================================
@@ -41,7 +41,7 @@
#include "misc/rcu.h"
static vlc_mutex_t config_lock = VLC_STATIC_MUTEX;
-static atomic_bool config_dirty = ATOMIC_VAR_INIT(false);
+static atomic_bool config_dirty = false;
void config_Lock(void)
{
=====================================
src/misc/cpu.c
=====================================
@@ -146,7 +146,7 @@ out:
unsigned vlc_CPU(void)
{
- static atomic_uint cpu_flags = ATOMIC_VAR_INIT(-1U);
+ static atomic_uint cpu_flags = -1U;
unsigned flags = atomic_load_explicit(&cpu_flags, memory_order_relaxed);
if (unlikely(flags == -1U)) {
=====================================
src/misc/threads.c
=====================================
@@ -84,23 +84,11 @@ void vlc_mutex_init_recursive(vlc_mutex_t *mtx)
bool vlc_mutex_held(const vlc_mutex_t *mtx)
{
-#if defined(__clang__) && !defined(__apple_build_version__) && (__clang_major__ < 8)
- /* The explicit cast to non-const is needed to workaround a clang
- * error with clang 7 or lower, as atomic_load_explicit in C11 did not
- * allow its first argument to be const-qualified (see DR459).
- * Apple Clang is not checked as it uses a different versioning and
- * oldest supported Xcode/Apple Clang version is not affected.
- */
- vlc_mutex_t *tmp_mtx = (vlc_mutex_t *)mtx;
-#else
- const vlc_mutex_t *tmp_mtx = mtx;
-#endif
-
/* This comparison is thread-safe:
* Even though other threads may modify the owner field at any time,
* they will never make it compare equal to the calling thread.
*/
- return vlc_thread_id() == atomic_load_explicit(&tmp_mtx->owner,
+ return vlc_thread_id() == atomic_load_explicit(&mtx->owner,
memory_order_relaxed);
}
=====================================
src/misc/threads.h
=====================================
@@ -51,7 +51,7 @@ typedef struct {
atomic_ulong owner;
} vlc_queuedmutex_t;
-#define VLC_STATIC_QUEUEDMUTEX { ATOMIC_VAR_INIT(0), ATOMIC_VAR_INIT(0), ATOMIC_VAR_INIT(0) }
+#define VLC_STATIC_QUEUEDMUTEX { 0, 0, 0 }
void vlc_queuedmutex_init(vlc_queuedmutex_t *m);
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/37bf8806dcd6b4f04cf3f0a0cc21470c801e9980...685ecc6ba7e653fba619cd22dc0e0fc3d29bd665
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/37bf8806dcd6b4f04cf3f0a0cc21470c801e9980...685ecc6ba7e653fba619cd22dc0e0fc3d29bd665
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list