From b9b58f122b0a759b4e6e047f7e07f15f6663911a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <kasper93@gmail.com>
Date: Mon, 18 Sep 2023 15:42:01 +0200
Subject: [PATCH] ci: enable -Werror

For better feedback on build status and to keep mpv warning free.

Except for macos builds, there are more issue there that need fixing.
---
 ci/build-freebsd.sh    | 2 ++
 ci/build-mingw64.sh    | 2 ++
 ci/build-msys2.sh      | 2 ++
 ci/build-tumbleweed.sh | 2 ++
 meson.build            | 2 --
 5 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/ci/build-freebsd.sh b/ci/build-freebsd.sh
index 67fdb2747a..c9a27cfa2a 100755
--- a/ci/build-freebsd.sh
+++ b/ci/build-freebsd.sh
@@ -6,6 +6,8 @@ export CXXFLAGS="$CXXFLAGS -isystem/usr/local/include"
 export LDFLAGS="$LDFLAGS -L/usr/local/lib"
 
 meson setup build \
+    --werror      \
+    -Dc_args="-Wno-error=deprecated -Wno-error=deprecated-declarations" \
     -Dlibmpv=true \
     -Dlua=enabled \
     -Degl-drm=enabled \
diff --git a/ci/build-mingw64.sh b/ci/build-mingw64.sh
index d9d050b4bb..259ba86c5a 100755
--- a/ci/build-mingw64.sh
+++ b/ci/build-mingw64.sh
@@ -268,6 +268,8 @@ build=mingw_build
 rm -rf $build
 
 meson setup $build --cross-file "$prefix_dir/crossfile" \
+    --werror                   \
+    -Dc_args="-Wno-error=deprecated -Wno-error=deprecated-declarations" \
     --buildtype debugoptimized \
     -Dlibmpv=true -Dlua=luajit \
     -D{shaderc,spirv-cross,d3d11,libplacebo}=enabled
diff --git a/ci/build-msys2.sh b/ci/build-msys2.sh
index b4226379ad..ca12987ac2 100755
--- a/ci/build-msys2.sh
+++ b/ci/build-msys2.sh
@@ -1,6 +1,8 @@
 #!/bin/sh -e
 
 meson setup build            \
+  --werror                   \
+  -Dc_args="-Wno-error=deprecated -Wno-error=deprecated-declarations" \
   -D cdda=enabled            \
   -D d3d-hwaccel=enabled     \
   -D d3d11=enabled           \
diff --git a/ci/build-tumbleweed.sh b/ci/build-tumbleweed.sh
index 2e38a34906..89253a4a8f 100755
--- a/ci/build-tumbleweed.sh
+++ b/ci/build-tumbleweed.sh
@@ -2,6 +2,8 @@
 set -e
 
 meson setup build \
+  --werror        \
+  -Dc_args="-Wno-error=deprecated -Wno-error=deprecated-declarations" \
   -Db_sanitize=address,undefined \
   -Dcdda=enabled          \
   -Ddvbin=enabled         \
diff --git a/meson.build b/meson.build
index a56bb1f37c..d6c76f3b08 100644
--- a/meson.build
+++ b/meson.build
@@ -256,8 +256,6 @@ flags = ['-D_ISOC99_SOURCE', '-D_GNU_SOURCE',
 link_flags = []
 
 test_flags = ['-Werror=implicit-function-declaration',
-              '-Wno-error=deprecated-declarations',
-              '-Wno-error=unused-function',
               '-Wempty-body',
               '-Wdisabled-optimization',
               '-Wstrict-prototypes',