From 6d3b5fdf632bc64980418b3efd69d67e6c79698b Mon Sep 17 00:00:00 2001 From: Vasily Date: Wed, 26 Dec 2018 23:01:11 +0100 Subject: [PATCH] Remove warnings for unreferenced parameters The warnings in dummy functions are preventing the project from being compiled with warnings as errors. There were two options: * Using a define to create a noop (chosen option). * Commenting out the variable name, leaving only the type. The first option was chosen because the second option would leave out information from the IDE and compiler, while the first option wouldn't. The intent is also clearer with the first option, otherwise it would likely be necessary to leave comments with every single parameter that was commented out. --- .../audiomanager/AudioManagerDummy.cpp | 14 ++++++++++++++ .../keyboardinput/KeyboardInputDummy.cpp | 5 +++++ 2 files changed, 19 insertions(+) diff --git a/src/tabcontrollers/audiomanager/AudioManagerDummy.cpp b/src/tabcontrollers/audiomanager/AudioManagerDummy.cpp index 2c3a612..d20016b 100644 --- a/src/tabcontrollers/audiomanager/AudioManagerDummy.cpp +++ b/src/tabcontrollers/audiomanager/AudioManagerDummy.cpp @@ -1,16 +1,22 @@ #include "AudioManagerDummy.h" +// Used to get the compiler to shut up about C4100: unreferenced formal parameter. +#define UNREFERENCED_PARAMETER(P) (P) + // application namespace namespace advsettings { void AudioManagerDummy::init(AudioTabController *controller) { // noop + UNREFERENCED_PARAMETER(controller); } void AudioManagerDummy::setPlaybackDevice(const std::string &id, bool notify) { // noop + UNREFERENCED_PARAMETER(id); + UNREFERENCED_PARAMETER(notify); } std::string AudioManagerDummy::getPlaybackDevName() @@ -26,6 +32,8 @@ std::string AudioManagerDummy::getPlaybackDevId() void AudioManagerDummy::setMirrorDevice(const std::string &id, bool notify) { // noop + UNREFERENCED_PARAMETER(id); + UNREFERENCED_PARAMETER(notify); } bool AudioManagerDummy::isMirrorValid() @@ -50,6 +58,7 @@ float AudioManagerDummy::getMirrorVolume() bool AudioManagerDummy::setMirrorVolume(float value) { + UNREFERENCED_PARAMETER(value); return false; } @@ -60,6 +69,7 @@ bool AudioManagerDummy::getMirrorMuted() bool AudioManagerDummy::setMirrorMuted(bool value) { + UNREFERENCED_PARAMETER(value); return false; } @@ -71,6 +81,8 @@ bool AudioManagerDummy::isMicValid() void AudioManagerDummy::setMicDevice(const std::string &id, bool notify) { // noop + UNREFERENCED_PARAMETER(id); + UNREFERENCED_PARAMETER(notify); } std::string AudioManagerDummy::getMicDevName() @@ -90,6 +102,7 @@ float AudioManagerDummy::getMicVolume() bool AudioManagerDummy::setMicVolume(float value) { + UNREFERENCED_PARAMETER(value); return false; } @@ -100,6 +113,7 @@ bool AudioManagerDummy::getMicMuted() bool AudioManagerDummy::setMicMuted(bool value) { + UNREFERENCED_PARAMETER(value); return false; } diff --git a/src/tabcontrollers/keyboardinput/KeyboardInputDummy.cpp b/src/tabcontrollers/keyboardinput/KeyboardInputDummy.cpp index 69054a9..2b00e33 100644 --- a/src/tabcontrollers/keyboardinput/KeyboardInputDummy.cpp +++ b/src/tabcontrollers/keyboardinput/KeyboardInputDummy.cpp @@ -1,10 +1,14 @@ #include "KeyboardInputDummy.h" +// Used to get the compiler to shut up about C4100: unreferenced formal parameter. +#define UNREFERENCED_PARAMETER(P) (P) + namespace advsettings { void KeyboardInputDummy::sendKeyboardInput(QString input) { // noop + UNREFERENCED_PARAMETER(input); } void KeyboardInputDummy::sendKeyboardEnter() @@ -15,6 +19,7 @@ void KeyboardInputDummy::sendKeyboardEnter() void KeyboardInputDummy::sendKeyboardBackspace(int count) { // noop + UNREFERENCED_PARAMETER(count); } void KeyboardInputDummy::sendKeyboardAltTab()