Skip to content

Commit

Permalink
Switch from the c++11 standard to the c++17 standard.
Browse files Browse the repository at this point in the history
Fix two new warnings that arise from this change.  One is to add
parentheses, and the other is that writing a custom 'operator='
function requires writing a custom copy constructor function.
  • Loading branch information
linuxdude42 committed Mar 21, 2020
1 parent 105faee commit c13e645
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 9 deletions.
3 changes: 1 addition & 2 deletions mythplugins/settings.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
CONFIG += $$CCONFIG
# enable C++11 support, QT5.7 will be based on C++11 anyway
CONFIG += c++11
CONFIG += c++17

LIBVERSION = 32

Expand Down
6 changes: 4 additions & 2 deletions mythtv/configure
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
LC_ALL=C
export LC_ALL

CPP_STANDARD=c++17

# make sure we are running under a compatible shell
# try to make this part work with most shells

Expand Down Expand Up @@ -4570,7 +4572,7 @@ fi

add_cppflags -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112
#add_cxxflags -D__STDC_CONSTANT_MACROS
check_cxxflags -std=c++11 || check_cxxflags -std=c++0x
check_cxxflags -std=$CPP_STANDARD -faligned-new

# some compilers silently accept -std=c11, so we also need to check that the
# version macro is defined properly
Expand Down Expand Up @@ -6918,7 +6920,6 @@ elif enabled icpc; then
# 10181: ignore warning about -fomit-frame-pointer being ignored
# 13200: ignore EMMS instruction required, RTjpegN.cpp does the right thing
check_cxxflags -wd177,192,592,913,10181,13200
check_cxxflags -std=c++11
elif enabled clangxx; then
# The constant-logical-operand only gives use false positives
# for constant logical operands meant to be optimized away.
Expand Down Expand Up @@ -7478,6 +7479,7 @@ echo "libdav1d (AV1) ${libdav1d-no}"
echo ""

echo "# Compilation Options"
echo "C++ standard supported ${CPP_STANDARD}"
echo "Enforce c++11 nullptr ${enforce_nullptr-no}"
echo "Enforce shadowed vars ${enforce_wshadow-no}"
echo ""
Expand Down
5 changes: 5 additions & 0 deletions mythtv/libs/libmyth/audio/eldutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,11 @@ ELD::ELD(const char *buf, int size)
update_eld(buf, size);
}

ELD::ELD(const ELD &rhs)
{
m_e = rhs.m_e;
}

ELD::ELD()
{
m_e.formats = 0LL;
Expand Down
1 change: 1 addition & 0 deletions mythtv/libs/libmyth/audio/eldutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class MPUBLIC ELD
{
public:
ELD(const char *buf, int size);
ELD(const ELD&);
ELD();
~ELD()= default;
ELD& operator=(const ELD& /*rhs*/);
Expand Down
2 changes: 2 additions & 0 deletions mythtv/libs/libmythbase/platforms/mythpowerdbus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,10 @@ void MythPowerDBus::Init(void)
{
QDBusReply<QList<QDBusObjectPath> > devices = m_upowerInterface->call(QLatin1String("EnumerateDevices"));
if (devices.isValid())
{
foreach (QDBusObjectPath device, devices.value())
DeviceAdded(device);
}

if (!m_bus.connect(UPOWER_SERVICE, UPOWER_PATH, UPOWER_SERVICE, "Changed", this, SLOT(Changed())))
{
Expand Down
6 changes: 3 additions & 3 deletions mythtv/programs/mythfrontend/videofileassoc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,19 @@ namespace
void SetDefault(bool yes_or_no)
{
assign_if_changed_notify(m_fa.use_default, yes_or_no, this,
std::mem_fun(&FileAssociationWrap::SetChanged));
std::mem_fn(&FileAssociationWrap::SetChanged));
}

void SetIgnore(bool yes_or_no)
{
assign_if_changed_notify(m_fa.ignore, yes_or_no, this,
std::mem_fun(&FileAssociationWrap::SetChanged));
std::mem_fn(&FileAssociationWrap::SetChanged));
}

void SetCommand(const QString &new_command)
{
assign_if_changed_notify(m_fa.playcommand, new_command, this,
std::mem_fun(&FileAssociationWrap::SetChanged));
std::mem_fn(&FileAssociationWrap::SetChanged));
}

private:
Expand Down
3 changes: 1 addition & 2 deletions mythtv/settings.pro
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ win32-msvc* {
}

CONFIG += $$CCONFIG
# enable C++11 support, QT5.7 will be based on C++11 anyway
CONFIG += c++11
CONFIG += c++17

defineReplace(avLibName) {
NAME = $$1
Expand Down

0 comments on commit c13e645

Please sign in to comment.