From 3e5cf3400273b0e4f8f96a3a87d2b9e57574eeec Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 16 Aug 2022 16:44:29 -0400 Subject: Upgrade to fmt 9.0.0 This library tends to break in annoying ways like this, so pin the major version to 9 to hopefully avoid these problems in the future. --- src/AlsaDriver.cpp | 1 - src/Canvas.cpp | 1 - src/ClientID.hpp | 9 +++++++++ src/ClientType.hpp | 25 +++++++++++++++++++++++++ src/Configuration.cpp | 2 ++ src/JackDbusDriver.cpp | 1 - src/PortID.hpp | 3 +++ src/PortType.hpp | 31 +++++++++++++++++++++++++++++++ src/Reactor.cpp | 18 +----------------- src/SignalDirection.hpp | 27 +++++++++++++++++++++++++++ src/event_to_string.cpp | 38 ++------------------------------------ src/handle_event.cpp | 1 - 12 files changed, 100 insertions(+), 57 deletions(-) (limited to 'src') diff --git a/src/AlsaDriver.cpp b/src/AlsaDriver.cpp index fbe7779..ee52aed 100644 --- a/src/AlsaDriver.cpp +++ b/src/AlsaDriver.cpp @@ -17,7 +17,6 @@ PATCHAGE_DISABLE_FMT_WARNINGS #include -#include // IWYU pragma: keep PATCHAGE_RESTORE_WARNINGS #include diff --git a/src/Canvas.cpp b/src/Canvas.cpp index 9b7760a..574bb33 100644 --- a/src/Canvas.cpp +++ b/src/Canvas.cpp @@ -32,7 +32,6 @@ PATCHAGE_RESTORE_WARNINGS PATCHAGE_DISABLE_FMT_WARNINGS #include -#include // IWYU pragma: keep PATCHAGE_RESTORE_WARNINGS #include diff --git a/src/ClientID.hpp b/src/ClientID.hpp index 9d4c361..d73e45e 100644 --- a/src/ClientID.hpp +++ b/src/ClientID.hpp @@ -5,6 +5,12 @@ #define PATCHAGE_CLIENTID_HPP #include "ClientType.hpp" +#include "warnings.hpp" + +PATCHAGE_DISABLE_FMT_WARNINGS +#include +#include +PATCHAGE_RESTORE_WARNINGS #include #include @@ -111,4 +117,7 @@ operator<(const ClientID& lhs, const ClientID& rhs) } // namespace patchage +template<> +struct fmt::formatter : fmt::ostream_formatter {}; + #endif // PATCHAGE_CLIENTID_HPP diff --git a/src/ClientType.hpp b/src/ClientType.hpp index 0812aa0..7a3f87a 100644 --- a/src/ClientType.hpp +++ b/src/ClientType.hpp @@ -4,6 +4,15 @@ #ifndef PATCHAGE_CLIENTTYPE_HPP #define PATCHAGE_CLIENTTYPE_HPP +#include "warnings.hpp" + +PATCHAGE_DISABLE_FMT_WARNINGS +#include +#include +PATCHAGE_RESTORE_WARNINGS + +#include + namespace patchage { /// A type of client (program) with supported ports @@ -12,6 +21,22 @@ enum class ClientType { alsa, }; +inline std::ostream& +operator<<(std::ostream& os, const ClientType type) +{ + switch (type) { + case ClientType::jack: + return os << "JACK"; + case ClientType::alsa: + return os << "ALSA"; + } + + return os; +} + } // namespace patchage +template<> +struct fmt::formatter : fmt::ostream_formatter {}; + #endif // PATCHAGE_CLIENTTYPE_HPP diff --git a/src/Configuration.cpp b/src/Configuration.cpp index fb53116..6490a88 100644 --- a/src/Configuration.cpp +++ b/src/Configuration.cpp @@ -18,6 +18,8 @@ #include #include +// IWYU pragma: no_include + namespace patchage { static const char* const port_type_names[N_PORT_TYPES] = {"JACK_AUDIO", diff --git a/src/JackDbusDriver.cpp b/src/JackDbusDriver.cpp index 22e64b5..81aca11 100644 --- a/src/JackDbusDriver.cpp +++ b/src/JackDbusDriver.cpp @@ -15,7 +15,6 @@ PATCHAGE_DISABLE_FMT_WARNINGS #include -#include // IWYU pragma: keep PATCHAGE_RESTORE_WARNINGS #include diff --git a/src/PortID.hpp b/src/PortID.hpp index 3c2fc58..54e4c5d 100644 --- a/src/PortID.hpp +++ b/src/PortID.hpp @@ -172,4 +172,7 @@ struct hash { } // namespace std +template<> +struct fmt::formatter : fmt::ostream_formatter {}; + #endif // PATCHAGE_PORTID_HPP diff --git a/src/PortType.hpp b/src/PortType.hpp index ec322b7..97ecaab 100644 --- a/src/PortType.hpp +++ b/src/PortType.hpp @@ -4,6 +4,15 @@ #ifndef PATCHAGE_PORTTYPE_HPP #define PATCHAGE_PORTTYPE_HPP +#include "warnings.hpp" + +PATCHAGE_DISABLE_FMT_WARNINGS +#include +#include +PATCHAGE_RESTORE_WARNINGS + +#include + namespace patchage { enum class PortType { @@ -14,6 +23,28 @@ enum class PortType { jack_cv, }; +inline std::ostream& +operator<<(std::ostream& os, const PortType port_type) +{ + switch (port_type) { + case PortType::jack_audio: + return os << "JACK audio"; + case PortType::jack_midi: + return os << "JACK MIDI"; + case PortType::alsa_midi: + return os << "ALSA MIDI"; + case PortType::jack_osc: + return os << "JACK OSC"; + case PortType::jack_cv: + return os << "JACK CV"; + } + + PATCHAGE_UNREACHABLE(); +} + } // namespace patchage +template<> +struct fmt::formatter : fmt::ostream_formatter {}; + #endif // PATCHAGE_PORTTYPE_HPP diff --git a/src/Reactor.cpp b/src/Reactor.cpp index f72086d..3c634ab 100644 --- a/src/Reactor.cpp +++ b/src/Reactor.cpp @@ -22,13 +22,10 @@ PATCHAGE_DISABLE_FMT_WARNINGS #include -#include // IWYU pragma: keep PATCHAGE_RESTORE_WARNINGS #include -#include - namespace patchage { class SettingVisitor @@ -50,19 +47,6 @@ private: Configuration& _conf; }; -inline std::ostream& -operator<<(std::ostream& os, const ClientType type) -{ - switch (type) { - case ClientType::jack: - return os << "JACK"; - case ClientType::alsa: - return os << "ALSA"; - } - - return os; -} - Reactor::Reactor(Configuration& conf, Drivers& drivers, Canvas& canvas, @@ -127,7 +111,7 @@ Reactor::operator()(const action::DisconnectPorts& action) if (auto* d = _drivers.driver(action.tail.type())) { d->disconnect(action.tail, action.head); } else { - _log.error(fmt::format("No driver for {}", action.tail.type())); + _log.error(fmt::format("No driver available to disconnect ports")); } } else { _log.error("Unable to disconnect incompatible ports"); diff --git a/src/SignalDirection.hpp b/src/SignalDirection.hpp index 3d499a4..84c3cc2 100644 --- a/src/SignalDirection.hpp +++ b/src/SignalDirection.hpp @@ -4,6 +4,15 @@ #ifndef PATCHAGE_SIGNALDIRECTION_HPP #define PATCHAGE_SIGNALDIRECTION_HPP +#include "warnings.hpp" + +PATCHAGE_DISABLE_FMT_WARNINGS +#include +#include +PATCHAGE_RESTORE_WARNINGS + +#include + namespace patchage { enum class SignalDirection { @@ -12,6 +21,24 @@ enum class SignalDirection { duplex, }; +inline std::ostream& +operator<<(std::ostream& os, const SignalDirection direction) +{ + switch (direction) { + case SignalDirection::input: + return os << "input"; + case SignalDirection::output: + return os << "output"; + case SignalDirection::duplex: + return os << "duplex"; + } + + PATCHAGE_UNREACHABLE(); +} + } // namespace patchage +template<> +struct fmt::formatter : fmt::ostream_formatter {}; + #endif // PATCHAGE_SIGNALDIRECTION_HPP diff --git a/src/event_to_string.cpp b/src/event_to_string.cpp index 366859a..dc14a4d 100644 --- a/src/event_to_string.cpp +++ b/src/event_to_string.cpp @@ -15,13 +15,11 @@ PATCHAGE_DISABLE_FMT_WARNINGS #include -#include // IWYU pragma: keep PATCHAGE_RESTORE_WARNINGS #include #include -#include // IWYU pragma: keep #include namespace patchage { @@ -65,44 +63,12 @@ struct EventPrinter { return fmt::format(R"(Remove client "{}")", event.id); } - std::string operator()(const PortType port_type) - { - switch (port_type) { - case PortType::jack_audio: - return "JACK audio"; - case PortType::jack_midi: - return "JACK MIDI"; - case PortType::alsa_midi: - return "ALSA MIDI"; - case PortType::jack_osc: - return "JACK OSC"; - case PortType::jack_cv: - return "JACK CV"; - } - - PATCHAGE_UNREACHABLE(); - } - - std::string operator()(const SignalDirection direction) - { - switch (direction) { - case SignalDirection::input: - return "input"; - case SignalDirection::output: - return "output"; - case SignalDirection::duplex: - return "duplex"; - } - - PATCHAGE_UNREACHABLE(); - } - std::string operator()(const event::PortCreated& event) { auto result = fmt::format(R"(Add{} {} {} port "{}" ("{}"))", event.info.is_terminal ? " terminal" : "", - (*this)(event.info.type), - (*this)(event.info.direction), + event.info.type, + event.info.direction, event.id, event.info.label); diff --git a/src/handle_event.cpp b/src/handle_event.cpp index d5d8ed7..710c4af 100644 --- a/src/handle_event.cpp +++ b/src/handle_event.cpp @@ -16,7 +16,6 @@ PATCHAGE_DISABLE_FMT_WARNINGS #include -#include // IWYU pragma: keep PATCHAGE_RESTORE_WARNINGS #include -- cgit v1.2.1