diff --git a/NEWS b/NEWS
index daac3aef0..be3124e01 100644
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,8 @@ ver 0.23 (not yet released)
* new build-time dependency: libfmt
ver 0.22.9 (not yet released)
+* Windows
+ - fix build failure with SQLite
ver 0.22.8 (2021/05/22)
* fix crash bug in "albumart" command (0.22.7 regression)
diff --git a/doc/user.rst b/doc/user.rst
index fdbd4af36..51d952c20 100644
--- a/doc/user.rst
+++ b/doc/user.rst
@@ -55,7 +55,7 @@ and unpack it (or `clone the git repository
In any case, you need:
-* a C++17 compiler (e.g. GCC 8 or clang 5)
+* a C++17 compiler (e.g. GCC 8 or clang 7)
* `Meson 0.49.0 `__ and `Ninja
`__
* Boost 1.58
diff --git a/meson.build b/meson.build
index b7be517dd..45380212f 100644
--- a/meson.build
+++ b/meson.build
@@ -24,8 +24,8 @@ c_compiler = meson.get_compiler('c')
if compiler.get_id() == 'gcc' and compiler.version().version_compare('<8')
warning('Your GCC version is too old. You need at least version 8.')
-elif compiler.get_id() == 'clang' and compiler.version().version_compare('<5')
- warning('Your clang version is too old. You need at least version 5.')
+elif compiler.get_id() == 'clang' and compiler.version().version_compare('<7')
+ warning('Your clang version is too old. You need at least version 7.')
endif
version_conf = configuration_data()
@@ -42,57 +42,64 @@ common_cppflags = [
'-D_GNU_SOURCE',
]
-common_cflags = [
-]
-
-common_cxxflags = [
+test_global_common_flags = [
+ '-fvisibility=hidden',
]
test_common_flags = [
'-Wvla',
'-Wdouble-promotion',
- '-fvisibility=hidden',
-
'-ffast-math',
'-ftree-vectorize',
]
+test_global_cxxflags = test_global_common_flags + [
+]
+
+test_global_cflags = test_global_common_flags + [
+]
+
test_cxxflags = test_common_flags + [
'-fno-threadsafe-statics',
'-fmerge-all-constants',
- '-Wmissing-declarations',
- '-Wshadow',
- '-Wpointer-arith',
'-Wcast-qual',
- '-Wwrite-strings',
- '-Wsign-compare',
- '-Wcomma',
+ '-Wcomma-subscript',
'-Wextra-semi',
+ '-Wmismatched-tags',
+ '-Wmissing-declarations',
+ '-Woverloaded-virtual',
+ '-Wshadow',
+ '-Wsign-promo',
+ '-Wunused',
+ '-Wvolatile',
+ '-Wvirtual-inheritance',
+ '-Wwrite-strings',
+
+ # a vtable without a dtor is just fine
+ '-Wno-non-virtual-dtor',
+
+ # clang specific warning options:
+ '-Wcomma',
'-Wheader-hygiene',
'-Winconsistent-missing-destructor-override',
- '-Wunreachable-code-break',
- '-Wunused',
+ '-Wunreachable-code-aggressive',
'-Wused-but-marked-unused',
-
- '-Wno-non-virtual-dtor',
]
-if compiler.get_id() == 'clang'
- # Workaround for clang bug
- # https://bugs.llvm.org/show_bug.cgi?id=32611
- test_cxxflags += '-funwind-tables'
+if compiler.get_id() != 'gcc' or compiler.version().version_compare('>=9')
+ # The GCC 8 implementation of this flag is buggy: it complains even
+ # if "final" is present, which implies "override".
+ test_cxxflags += '-Wsuggest-override'
endif
test_cflags = test_common_flags + [
+ '-Wcast-qual',
'-Wmissing-prototypes',
'-Wshadow',
- '-Wpointer-arith',
'-Wstrict-prototypes',
- '-Wcast-qual',
'-Wwrite-strings',
- '-pedantic',
]
test_ldflags = [
@@ -104,11 +111,11 @@ test_ldflags = [
]
if get_option('buildtype') != 'debug'
- test_cxxflags += [
+ test_global_cxxflags += [
'-ffunction-sections',
'-fdata-sections',
]
- test_cflags += [
+ test_global_cflags += [
'-ffunction-sections',
'-fdata-sections',
]
@@ -127,9 +134,11 @@ if get_option('fuzzer')
add_global_link_arguments(fuzzer_flags, language: 'cpp')
endif
-add_global_arguments(common_cxxflags + compiler.get_supported_arguments(test_cxxflags), language: 'cpp')
-add_global_arguments(common_cflags + c_compiler.get_supported_arguments(test_cflags), language: 'c')
-add_global_link_arguments(compiler.get_supported_link_arguments(test_ldflags), language: 'cpp')
+add_global_arguments(compiler.get_supported_arguments(test_global_cxxflags), language: 'cpp')
+add_global_arguments(c_compiler.get_supported_arguments(test_global_cflags), language: 'c')
+add_project_arguments(compiler.get_supported_arguments(test_cxxflags), language: 'cpp')
+add_project_arguments(c_compiler.get_supported_arguments(test_cflags), language: 'c')
+add_project_link_arguments(compiler.get_supported_link_arguments(test_ldflags), language: 'cpp')
is_linux = host_machine.system() == 'linux'
is_android = get_option('android_ndk') != ''
diff --git a/src/decoder/plugins/MadDecoderPlugin.cxx b/src/decoder/plugins/MadDecoderPlugin.cxx
index 8fb99a0cd..7b6c98eec 100644
--- a/src/decoder/plugins/MadDecoderPlugin.cxx
+++ b/src/decoder/plugins/MadDecoderPlugin.cxx
@@ -889,8 +889,6 @@ inline bool
MadDecoder::HandleCurrentFrame() noexcept
{
switch (mute_frame) {
- DecoderCommand cmd;
-
case MadDecoderMuteFrame::SKIP:
mute_frame = MadDecoderMuteFrame::NONE;
break;
@@ -899,8 +897,8 @@ MadDecoder::HandleCurrentFrame() noexcept
mute_frame = MadDecoderMuteFrame::NONE;
UpdateTimerNextFrame();
break;
- case MadDecoderMuteFrame::NONE:
- cmd = SynthAndSubmit();
+ case MadDecoderMuteFrame::NONE: {
+ const auto cmd = SynthAndSubmit();
UpdateTimerNextFrame();
if (cmd == DecoderCommand::SEEK) {
assert(input_stream.IsSeekable());
@@ -922,6 +920,7 @@ MadDecoder::HandleCurrentFrame() noexcept
} else if (cmd != DecoderCommand::NONE)
return false;
}
+ }
return true;
}
diff --git a/src/lib/sqlite/meson.build b/src/lib/sqlite/meson.build
index 6a5d07ef5..2db7fc8ae 100644
--- a/src/lib/sqlite/meson.build
+++ b/src/lib/sqlite/meson.build
@@ -1,5 +1,7 @@
if enable_database
- sqlite_dep = dependency('sqlite3', version: '>= 3.7.3', required: get_option('sqlite'))
+ sqlite_dep = dependency('sqlite3', version: '>= 3.7.3',
+ fallback: ['sqlite3', 'sqlite3_dep'],
+ required: get_option('sqlite'))
else
sqlite_dep = dependency('', required: false)
endif
@@ -21,4 +23,7 @@ sqlite = static_library(
sqlite_dep = declare_dependency(
link_with: sqlite,
+ dependencies: [
+ sqlite_dep,
+ ],
)
diff --git a/src/sticker/Database.cxx b/src/sticker/Database.cxx
index 860b40dd3..a39cfc93a 100644
--- a/src/sticker/Database.cxx
+++ b/src/sticker/Database.cxx
@@ -21,6 +21,7 @@
#include "Sticker.hxx"
#include "lib/sqlite/Util.hxx"
#include "fs/Path.hxx"
+#include "fs/NarrowPath.hxx"
#include "Idle.hxx"
#include "util/StringCompare.hxx"
#include "util/ScopeExit.hxx"
@@ -82,7 +83,7 @@ static const char sticker_sql_create[] =
"";
StickerDatabase::StickerDatabase(Path path)
- :db(path.c_str())
+ :db(NarrowPath(path))
{
assert(!path.IsNull());
diff --git a/src/zeroconf/avahi/Poll.cxx b/src/zeroconf/avahi/Poll.cxx
index 0cec88f17..1d0f39895 100644
--- a/src/zeroconf/avahi/Poll.cxx
+++ b/src/zeroconf/avahi/Poll.cxx
@@ -89,13 +89,13 @@ public:
:event(_loop, BIND_THIS_METHOD(OnTimeout)),
callback(_callback), userdata(_userdata) {
if (tv != nullptr)
- event.Schedule(ToSteadyClockDuration(*tv));
+ Schedule(*tv);
}
static void TimeoutUpdate(AvahiTimeout *t,
const struct timeval *tv) noexcept {
if (tv != nullptr)
- t->event.Schedule(ToSteadyClockDuration(*tv));
+ t->Schedule(*tv);
else
t->event.Cancel();
}
@@ -105,6 +105,30 @@ public:
}
private:
+ [[gnu::pure]]
+ Event::Duration AbsoluteToDuration(const struct timeval &tv) noexcept {
+ if (tv.tv_sec == 0)
+ /* schedule immediately */
+ return {};
+
+ struct timeval now;
+ if (gettimeofday(&now, nullptr) < 0)
+ /* shouldn't ever fail, but if it does, do
+ something reasonable */
+ return std::chrono::seconds(1);
+
+ auto d = ToSteadyClockDuration(tv)
+ - ToSteadyClockDuration(now);
+ if (d.count() < 0)
+ return {};
+
+ return d;
+ }
+
+ void Schedule(const struct timeval &tv) noexcept {
+ event.Schedule(AbsoluteToDuration(tv));
+ }
+
void OnTimeout() noexcept {
callback(this, userdata);
}
diff --git a/subprojects/.gitignore b/subprojects/.gitignore
index 3b16707d0..6ab284255 100644
--- a/subprojects/.gitignore
+++ b/subprojects/.gitignore
@@ -2,3 +2,4 @@
/fmt-*/
/googletest-*/
+/sqlite-*/
diff --git a/subprojects/sqlite3.wrap b/subprojects/sqlite3.wrap
new file mode 100644
index 000000000..4d51dc053
--- /dev/null
+++ b/subprojects/sqlite3.wrap
@@ -0,0 +1,12 @@
+[wrap-file]
+directory = sqlite-amalgamation-3340100
+source_url = https://www.sqlite.org/2021/sqlite-amalgamation-3340100.zip
+source_filename = sqlite-amalgamation-3340100.zip
+source_hash = e0b1c0345fe4338b936e17da8e1bd88366cd210e576834546977f040c12a8f68
+patch_url = https://wrapdb.mesonbuild.com/v1/projects/sqlite3/3.34.1/1/get_zip
+patch_filename = sqlite3-3.34.1-1-wrap.zip
+patch_hash = cba9e47bdb4c02f88fadaae8deab357218d32562c6b86ce7ba0c72f107044360
+
+[provide]
+sqlite3 = sqlite3_dep
+