Warning reports


Hi, I am building the juce tip on Xcode 4 with fairly high warning settings. May I report here those warnings I get, in the hope they get fixed from time to time?


What would be the point of that? Jules could just set the warning level to maximum and see them all himself…lol.


Maybe he doesn’t want to bother with hunting all the possible warnings for every possible compiler and settings combination that is out there. Since I think that my settings are sensible, I hope that “fixing” them enhances even more the quality of the JUCE codebase


There are a dozen “losing precision” warnings when compiling for 64bit, for example.


I normally have my warning level set as high as possible without it generating too many false positives, but sure, if you see any flags that I should enable, please let me know!


Yes, but they’re in the ogg-vorbis codebase, not mine! I can’t use some of the stricter warnings because they spew out hundreds of warnings in the 3rd party library code. Ideally I’d like to be able to use insanely high warnings for my own code, but AFAIK it’s not possible in GCC to disable warnings via a pragma, which is what I’d need to do to avoid all the warnings in the 3rd-party sections.


I suspected that was the reason. As for your information, the latest Xcode4 Apple LLVM compiler supports the #pragma diagnostic to disable warnings in certain sections.


However, here is a list of reported warnings that I think are quite easy to fix (I’m adding one file by post, so they can be removed one by one as if checking a to-do list):

In juce_InterProcessLock.h, line 93

explicit ScopedLockType (InterProcessLock& lock) : ipLock (lock) { lockWasSuccessful = lock.enter(); }

the lock argument shadows a member of InterProcessLock class


in juce_osx_MessageQueue, line 42

CFRunLoopSourceContext sourceContext = { 0 };

It complains the initialisers lacks a “info” initialiser (I suspect it does not support the standard = { 0 } initialisation)


juce_MidiDataConcatenator.h, line 66

shadows the argument to pushMidiData with the same name


juce_AudioFormatWriter.cpp, line 173:

Buffer (TimeSliceThread& timeSliceThread_, AudioFormatWriter* writer_, int numChannels, int bufferSize_)

the numChannel argument shadows a member of AudioFormatWriter class


juce_CoreAudioFormat.cpp, line 250:

AudioFormatWriter* CoreAudioFormat::createWriterFor (OutputStream* streamToWriteTo, double sampleRateToUse, unsigned int numberOfChannels, int bitsPerSample, const StringPairArray& metadataValues, int qualityOptionIndex) { jassertfalse; // not yet implemented! return nullptr; }

the arguments to this function are unused and cause warnings, their names can be commented



line 447:

VstInt32 processEvents (VstEvents* events) { #if JucePlugin_WantsMidiInput VSTMidiEventList::addEventsToMidiBuffer (events, midiEvents); return 1; #else return 0; #endif }

argument “events” is unused in some circumstances

line 1474:

[code] extern “C” attribute ((visibility(“default”))) AEffect* VSTPluginMain (audioMasterCallback audioMaster)
return pluginEntryPoint (audioMaster);

extern "C" __attribute__ ((visibility("default"))) AEffect* main_macho (audioMasterCallback audioMaster)
    return pluginEntryPoint (audioMaster);


prototypes for these functions are missing



line 316:

source is a field of AudioThumbnail already

line 377:

void drawChannel (Graphics& g, const Rectangle<int>& area, const double startTime, const double endTime, const int channelNum, const float verticalZoomFactor, const double sampleRate, const int numChannels, const int samplesPerThumbSample, LevelDataSource* levelData, const OwnedArray<ThumbData>& channels)

sampleRate, numChannels, samplesPerThumbSample and channels are all fields of AudioThumbnail already

line 419:

void refillCache (const int numSamples, double startTime, const double endTime, const double sampleRate, const int numChannels, const int samplesPerThumbSample, LevelDataSource* levelData, const OwnedArray<ThumbData>& channels)

same as above


in juce_VST_Wrapper.mm

Prototypes are missing for the following functions:

this one also has some of its arguments unused depending on 32/64 bit build, I suggest to mark them all as used with (void*)arg; (maybe a macro to do this could be useful and more readable?)

some arguments are unused in some builds

some arguments are unused in some builds

some arguments are unused in some builds


in juce_AU_Wrapper.mm

line 770:

the i variable is already declared above, I suspect it is that declaration that should be pushed inside the for loops that precede this one, like you did in many other places already

line 838:

OSStatus HandleMidiEvent (UInt8 nStatus, UInt8 inChannel, UInt8 inData1, UInt8 inData2, #if defined (MAC_OS_X_VERSION_10_5) UInt32 inStartFrame) #else long inStartFrame) #endif

some arguments are unused in certain builds

line 857:

OSStatus HandleSysEx (const UInt8* inData, UInt32 inLength) { #if JucePlugin_WantsMidiInput const ScopedLock sl (incomingMidiLock); incomingEvents.addEvent (inData, inLength, 0); #endif return noErr; }

some arguments are unused in certain builds

line 875:

presetArray is a field of JuceAU class already

line 1096:

static BOOL mouseDownCanMoveWindow (id self, SEL) { return NO; }
unused parameter self

line 1140:

[code]- (NSView*) uiViewForAudioUnit: (AudioUnit) inAudioUnit
withSize: (NSSize) inPreferredSize
void* pointers[2];
UInt32 propertySize = sizeof (pointers);

if (AudioUnitGetProperty (inAudioUnit,
                          &propertySize) != noErr)
    return nil;

AudioProcessor* filter = (AudioProcessor*) pointers[0];
JuceAU* au = (JuceAU*) pointers[1];

if (filter == nullptr)
    return nil;

AudioProcessorEditor* editorComp = filter->createEditorIfNeeded();
if (editorComp == nullptr)
    return nil;

return EditorCompHolder::createViewFor (filter, au, editorComp);


unused parameter inPreferredSize



missing prototypes for these funcions:

line 67:

this local variable is used nowhere



all the methods taking a “term” argument shadow the “term” field of class Expression.

Plus this happens also on line 816:



compiler complains in all the = { 0 }; initialisations, which are:

line 78:

line 204:

line 396:


juce_LocalisedStrings.cpp, line 183:

currentMappings shadows a symbol that is already in the anonymous namespace for this file