summaryrefslogtreecommitdiff
path: root/recipes
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2023-03-06 15:16:40 +0530
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>2023-06-08 15:28:10 +0000
commit8c69e7ffd87794c5c7f4a2227334aac80855c021 (patch)
tree7341454f5a93561772a47da121d04a7cf4018847 /recipes
parentda0c91923872c42873b57f1961ab2b052d9d841f (diff)
taglib.recipe: Fix deprecation warnings on macOS
Part-of: <https://gitlab.freedesktop.org/gstreamer/cerbero/-/merge_requests/1115>
Diffstat (limited to 'recipes')
-rw-r--r--recipes/taglib.recipe2
-rw-r--r--recipes/taglib/0001-Don-t-use-deprecated-OSAtomic-on-macOS-10.12-and-new.patch195
2 files changed, 197 insertions, 0 deletions
diff --git a/recipes/taglib.recipe b/recipes/taglib.recipe
index d7269d7b..78c3fd9d 100644
--- a/recipes/taglib.recipe
+++ b/recipes/taglib.recipe
@@ -27,6 +27,8 @@ class Recipe(recipe.Recipe):
'taglib/0002-Build-a-static-and-non-static-version.patch',
# https://github.com/taglib/taglib/pull/1071
'taglib/0003-cmake-generate-pc-file-with-the-use-of-prefix-in-lib.patch',
+ # Upstream did this change once and then reverted it, so keep it private
+ 'taglib/0001-Don-t-use-deprecated-OSAtomic-on-macOS-10.12-and-new.patch',
]
files_libs = ['libtag']
diff --git a/recipes/taglib/0001-Don-t-use-deprecated-OSAtomic-on-macOS-10.12-and-new.patch b/recipes/taglib/0001-Don-t-use-deprecated-OSAtomic-on-macOS-10.12-and-new.patch
new file mode 100644
index 00000000..c0d6c8e8
--- /dev/null
+++ b/recipes/taglib/0001-Don-t-use-deprecated-OSAtomic-on-macOS-10.12-and-new.patch
@@ -0,0 +1,195 @@
+From 2f4766817a2b67b523b247e045049c6d434cab46 Mon Sep 17 00:00:00 2001
+From: Nirbheek Chauhan <nirbheek@centricular.com>
+Date: Thu, 8 Jun 2023 00:43:37 +0530
+Subject: [PATCH] Don't use deprecated OSAtomic on macOS 10.12 and newer
+
+Fixes deprecation warnings:
+
+```
+include/taglib/trefcounter.h:84:29: error: 'OSAtomicDecrement32Barrier' is deprecated: first deprecated in macOS 10.12 - Use std::atomic_fetch_sub() from <atomic> instead [-Werror,-Wdeprecated-declarations]
+ bool deref() { return ! OSAtomicDecrement32Barrier(const_cast<int32_t*>(&refCount)); }
+ ^
+/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/libkern/OSAtomicDeprecated.h:202:9: note: 'OSAtomicDecrement32Barrier' has been explicitly marked deprecated here
+int32_t OSAtomicDecrement32Barrier( volatile int32_t *__theValue );
+ ^
+2 errors generated.
+```
+---
+ ConfigureChecks.cmake | 14 ++-----
+ taglib/toolkit/trefcounter.cpp | 38 -----------------
+ taglib/toolkit/trefcounter.h | 76 ++++++++++++++++------------------
+ 3 files changed, 39 insertions(+), 89 deletions(-)
+
+diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
+index ee4fdc2..70bcd5d 100644
+--- a/ConfigureChecks.cmake
++++ b/ConfigureChecks.cmake
+@@ -72,17 +72,9 @@ if(NOT HAVE_STD_ATOMIC)
+ " HAVE_GCC_ATOMIC)
+
+ if(NOT HAVE_GCC_ATOMIC)
+- check_cxx_source_compiles("
+- #include <libkern/OSAtomic.h>
+- int main() {
+- volatile int32_t x;
+- OSAtomicIncrement32Barrier(&x);
+- int32_t y = OSAtomicDecrement32Barrier(&x);
+- return 0;
+- }
+- " HAVE_MAC_ATOMIC)
+-
+- if(NOT HAVE_MAC_ATOMIC)
++ if (APPLE)
++ set(HAVE_MAC_ATOMIC TRUE)
++ else()
+ check_cxx_source_compiles("
+ #include <windows.h>
+ int main() {
+diff --git a/taglib/toolkit/trefcounter.cpp b/taglib/toolkit/trefcounter.cpp
+index 27d17b8..b8221a6 100644
+--- a/taglib/toolkit/trefcounter.cpp
++++ b/taglib/toolkit/trefcounter.cpp
+@@ -29,44 +29,6 @@
+
+ #include "trefcounter.h"
+
+-#if defined(HAVE_STD_ATOMIC)
+-# include <atomic>
+-# define ATOMIC_INT std::atomic<unsigned int>
+-# define ATOMIC_INC(x) x.fetch_add(1)
+-# define ATOMIC_DEC(x) (x.fetch_sub(1) - 1)
+-#elif defined(HAVE_BOOST_ATOMIC)
+-# include <boost/atomic.hpp>
+-# define ATOMIC_INT boost::atomic<unsigned int>
+-# define ATOMIC_INC(x) x.fetch_add(1)
+-# define ATOMIC_DEC(x) (x.fetch_sub(1) - 1)
+-#elif defined(HAVE_GCC_ATOMIC)
+-# define ATOMIC_INT int
+-# define ATOMIC_INC(x) __sync_add_and_fetch(&x, 1)
+-# define ATOMIC_DEC(x) __sync_sub_and_fetch(&x, 1)
+-#elif defined(HAVE_WIN_ATOMIC)
+-# if !defined(NOMINMAX)
+-# define NOMINMAX
+-# endif
+-# include <windows.h>
+-# define ATOMIC_INT long
+-# define ATOMIC_INC(x) InterlockedIncrement(&x)
+-# define ATOMIC_DEC(x) InterlockedDecrement(&x)
+-#elif defined(HAVE_MAC_ATOMIC)
+-# include <libkern/OSAtomic.h>
+-# define ATOMIC_INT int32_t
+-# define ATOMIC_INC(x) OSAtomicIncrement32Barrier(&x)
+-# define ATOMIC_DEC(x) OSAtomicDecrement32Barrier(&x)
+-#elif defined(HAVE_IA64_ATOMIC)
+-# include <ia64intrin.h>
+-# define ATOMIC_INT int
+-# define ATOMIC_INC(x) __sync_add_and_fetch(&x, 1)
+-# define ATOMIC_DEC(x) __sync_sub_and_fetch(&x, 1)
+-#else
+-# define ATOMIC_INT int
+-# define ATOMIC_INC(x) (++x)
+-# define ATOMIC_DEC(x) (--x)
+-#endif
+-
+ namespace TagLib
+ {
+
+diff --git a/taglib/toolkit/trefcounter.h b/taglib/toolkit/trefcounter.h
+index bc3cdd9..0848f69 100644
+--- a/taglib/toolkit/trefcounter.h
++++ b/taglib/toolkit/trefcounter.h
+@@ -29,23 +29,39 @@
+ #include "taglib_export.h"
+ #include "taglib.h"
+
+-#ifdef __APPLE__
+-# include <libkern/OSAtomic.h>
+-# define TAGLIB_ATOMIC_MAC
+-#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+-# ifndef NOMINMAX
+-# define NOMINMAX
+-# endif
+-# include <windows.h>
+-# define TAGLIB_ATOMIC_WIN
+-#elif defined (__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 401) \
+- && (defined(__i386__) || defined(__i486__) || defined(__i586__) || \
+- defined(__i686__) || defined(__x86_64) || defined(__ia64)) \
+- && !defined(__INTEL_COMPILER)
+-# define TAGLIB_ATOMIC_GCC
+-#elif defined(__ia64) && defined(__INTEL_COMPILER)
+-# include <ia64intrin.h>
+-# define TAGLIB_ATOMIC_GCC
++#if defined(HAVE_GCC_ATOMIC)
++# define ATOMIC_INT int
++# define ATOMIC_INC(x) __sync_add_and_fetch(&(x), 1)
++# define ATOMIC_DEC(x) __sync_sub_and_fetch(&(x), 1)
++#elif defined(HAVE_WIN_ATOMIC)
++# if !defined(NOMINMAX)
++# define NOMINMAX
++# endif
++# include <windows.h>
++# define ATOMIC_INT long
++# define ATOMIC_INC(x) InterlockedIncrement(&x)
++# define ATOMIC_DEC(x) InterlockedDecrement(&x)
++#elif defined(HAVE_MAC_ATOMIC)
++# if defined(MAC_OS_VERSION_10_12) && MAC_OS_X_VERSION_MIN_ALLOWED >= MAC_OS_VERSION_10_12
++# include <stdatomic.h>
++# define ATOMIC_INT atomic_int
++# define ATOMIC_INC(x) std::atomic_fetch_add(&x, 1)
++# define ATOMIC_DEC(x) std::atomic_fetch_sub(&x, 1)
++# else
++# include <libkern/OSAtomic.h>
++# define ATOMIC_INT int32_t
++# define ATOMIC_INC(x) OSAtomicIncrement32Barrier(&x)
++# define ATOMIC_DEC(x) OSAtomicDecrement32Barrier(&x)
++# endif
++#elif defined(HAVE_IA64_ATOMIC)
++# include <ia64intrin.h>
++# define ATOMIC_INT int
++# define ATOMIC_INC(x) __sync_add_and_fetch(&x, 1)
++# define ATOMIC_DEC(x) __sync_sub_and_fetch(&x, 1)
++#else
++# define ATOMIC_INT unsigned int
++# define ATOMIC_INC(x) (++x)
++# define ATOMIC_DEC(x) (--x)
+ #endif
+
+ #ifndef DO_NOT_DOCUMENT // Tell Doxygen to skip this class.
+@@ -79,31 +95,11 @@ namespace TagLib
+ public:
+ RefCounterOld() : refCount(1) {}
+
+-#ifdef TAGLIB_ATOMIC_MAC
+- void ref() { OSAtomicIncrement32Barrier(const_cast<int32_t*>(&refCount)); }
+- bool deref() { return ! OSAtomicDecrement32Barrier(const_cast<int32_t*>(&refCount)); }
++ void ref() { ATOMIC_INC(refCount); }
++ bool deref() { return ATOMIC_DEC(refCount); }
+ int32_t count() { return refCount; }
+ private:
+- volatile int32_t refCount;
+-#elif defined(TAGLIB_ATOMIC_WIN)
+- void ref() { InterlockedIncrement(&refCount); }
+- bool deref() { return ! InterlockedDecrement(&refCount); }
+- long count() { return refCount; }
+- private:
+- volatile long refCount;
+-#elif defined(TAGLIB_ATOMIC_GCC)
+- void ref() { __sync_add_and_fetch(&refCount, 1); }
+- bool deref() { return ! __sync_sub_and_fetch(&refCount, 1); }
+- int count() { return refCount; }
+- private:
+- volatile int refCount;
+-#else
+- void ref() { refCount++; }
+- bool deref() { return ! --refCount; }
+- int count() { return refCount; }
+- private:
+- unsigned int refCount;
+-#endif
++ volatile ATOMIC_INT refCount;
+ };
+
+ }
+--
+2.39.2
+