Skip to content

Commit

Permalink
Turn on Wextra and Wpedantic on clang/gcc (#109)
Browse files Browse the repository at this point in the history
Ignore unused-parameter; it is useful to document intent, but keep
the rest of the warnings. gcc pragma ignore some vst3 headers to get
there.

If we merge #107 we will be able to turn on Werror also, at least
on mac and linux.
  • Loading branch information
baconpaul authored and defiantnerd committed Sep 9, 2023
1 parent 1a02801 commit fcaf1c6
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cmake/enable_sdks.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ function(target_add_vst3_wrapper)
)

if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU")
target_compile_options(${V3_TARGET}-clap-wrapper-vst3-lib PRIVATE -Wall)
target_compile_options(${V3_TARGET}-clap-wrapper-vst3-lib PRIVATE -Wall -Wextra -Wno-unused-parameter -Wpedantic)
endif()
if (APPLE)
target_link_libraries(${V3_TARGET}-clap-wrapper-vst3-lib PUBLIC macos_filesystem_support)
Expand Down
8 changes: 4 additions & 4 deletions src/detail/vst3/process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ namespace Clap
if ( numInputs > 0)
{
_input_ports = new clap_audio_buffer_t[numInputs];
for (int i = 0; i < numInputs; ++i)
for (auto i = 0U; i < numInputs; ++i)
{
clap_audio_buffer_t& bus = _input_ports[i];
Vst::BusInfo info;
Expand Down Expand Up @@ -77,7 +77,7 @@ namespace Clap
if (numOutputs > 0)
{
_output_ports = new clap_audio_buffer_t[numOutputs];
for (int i = 0; i < numOutputs; ++i)
for (auto i = 0U; i < numOutputs; ++i)
{
clap_audio_buffer_t& bus = _output_ports[i];
Vst::BusInfo info;
Expand Down Expand Up @@ -361,7 +361,7 @@ namespace Clap
{
// setting the buffers
auto inbusses = _audioinputs->size();
for (int i = 0; i < inbusses; ++i)
for (auto i = 0U; i < inbusses; ++i)
{
if (_vstdata->inputs[i].numChannels > 0)
_input_ports[i].data32 = _vstdata->inputs[i].channelBuffers32;
Expand All @@ -370,7 +370,7 @@ namespace Clap
}

auto outbusses = _audiooutputs->size();
for (int i = 0; i < outbusses; ++i)
for (auto i = 0U; i < outbusses; ++i)
{
if (_vstdata->outputs[i].numChannels > 0)
_output_ports[i].data32 = _vstdata->outputs[i].channelBuffers32;
Expand Down
11 changes: 11 additions & 0 deletions src/detail/vst3/process.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,21 @@
*/
#include <clap/clap.h>

#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wextra"
#endif

#include <pluginterfaces/vst/ivstevents.h>
#include <pluginterfaces/vst/ivstaudioprocessor.h>
#include <public.sdk/source/vst/vstparameters.h>
#include <public.sdk/source/vst/vstbus.h>

#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif

#include <vector>
#include <memory>

Expand Down
6 changes: 3 additions & 3 deletions src/wrapasvst3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,11 +399,11 @@ void ClapAsVst3::addMIDIBusFrom(const clap_note_port_info_t* info, uint32_t inde

void ClapAsVst3::updateAudioBusses()
{
for ( int i = 0 ; i < audioInputs.size() ; ++i)
for ( auto i = 0U; i < audioInputs.size() ; ++i)
{
_processAdapter->activateAudioBus(Vst::kInput, i,audioInputs[i]->isActive());
}
for (int i = 0; i < audioOutputs.size(); ++i)
for (auto i = 0U; i < audioOutputs.size(); ++i)
{
_processAdapter->activateAudioBus(Vst::kOutput, i, audioOutputs[i]->isActive());
}
Expand Down Expand Up @@ -668,7 +668,7 @@ void ClapAsVst3::param_rescan(clap_param_rescan_flags flags)
vstflags |= Vst::RestartFlags::kMidiCCAssignmentChanged;
}

vstflags |= ((flags & CLAP_PARAM_RESCAN_VALUES) ? Vst::RestartFlags::kParamValuesChanged : 0u);
vstflags |= ((flags & CLAP_PARAM_RESCAN_VALUES) ? (uint32_t)Vst::RestartFlags::kParamValuesChanged : 0u);
vstflags |= ((flags & CLAP_PARAM_RESCAN_INFO) ? Vst::RestartFlags::kParamValuesChanged | Vst::RestartFlags::kParamTitlesChanged : 0u);
if (vstflags != 0)
{
Expand Down
11 changes: 11 additions & 0 deletions src/wrapasvst3.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,21 @@
*/

#include "clap_proxy.h"

#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wextra"
#endif

#include <pluginterfaces/vst/ivstmidicontrollers.h>
#include <pluginterfaces/vst/ivstnoteexpression.h>
#include <public.sdk/source/vst/vstsinglecomponenteffect.h>
#include <public.sdk/source/vst/vstnoteexpressiontypes.h>

#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif

#include "detail/vst3/plugview.h"
#include "detail/os/osutil.h"
#include "detail/clap/automation.h"
Expand Down
2 changes: 1 addition & 1 deletion src/wrapasvst3_entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ IPluginFactory* GetPluginFactoryEntryPoint() {
char x[sizeof(g)*2+8];
char* o = x;
constexpr char hexchar[] = "0123456789ABCDEF";
for (int i = 0 ; i < sizeof(g) ; i++)
for (auto i = 0U ; i < sizeof(g) ; i++)
{
auto n = v[i];
*o++ = hexchar[(n >> 4) & 0xF];
Expand Down

0 comments on commit fcaf1c6

Please sign in to comment.