# Warning reports

**URL:** <https://forum.juce.com/t/warning-reports/9270>\
**Category:** General JUCE discussion\
**Created:** [September 20, 2012, 2:56pm UTC](https://forum.juce.com/t/warning-reports/9270 "2012-09-20T14:56:08Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![yfede](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/yfede/32/506_2.png) [@yfede](https://forum.juce.com/u/yfede)\
**Post date:** [September 20, 2012, 2:56pm UTC](https://forum.juce.com/t/warning-reports/9270/1 "2012-09-20T14:56:08Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![TheVinn](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/thevinn/32/806_2.png) [@TheVinn](https://forum.juce.com/u/TheVinn)\
**Post date:** [September 20, 2012, 3:54pm UTC](https://forum.juce.com/t/warning-reports/9270/2 "2012-09-20T15:54:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![yfede](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/yfede/32/506_2.png) [@yfede](https://forum.juce.com/u/yfede)\
**Post date:** [September 20, 2012, 4:31pm UTC](https://forum.juce.com/t/warning-reports/9270/3 "2012-09-20T16:31:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ivann](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ivann/32/324_2.png) [@ivann](https://forum.juce.com/u/ivann)\
**Post date:** [September 21, 2012, 6:39am UTC](https://forum.juce.com/t/warning-reports/9270/4 "2012-09-21T06:39:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [September 21, 2012, 8:28am UTC](https://forum.juce.com/t/warning-reports/9270/5 "2012-09-21T08:28:21Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [September 21, 2012, 8:37am UTC](https://forum.juce.com/t/warning-reports/9270/6 "2012-09-21T08:37:56Z")

</div>

> [@ivann](#):
>
> There are a dozen “losing precision” warnings when compiling for 64bit, for example.

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.

---

<div class="post-metadata">

**Author:** ![yfede](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/yfede/32/506_2.png) [@yfede](https://forum.juce.com/u/yfede)\
**Post date:** [September 24, 2012, 10:08am UTC](https://forum.juce.com/t/warning-reports/9270/7 "2012-09-24T10:08:52Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![yfede](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/yfede/32/506_2.png) [@yfede](https://forum.juce.com/u/yfede)\
**Post date:** [September 24, 2012, 10:09am UTC](https://forum.juce.com/t/warning-reports/9270/8 "2012-09-24T10:09:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![yfede](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/yfede/32/506_2.png) [@yfede](https://forum.juce.com/u/yfede)\
**Post date:** [September 24, 2012, 10:11am UTC](https://forum.juce.com/t/warning-reports/9270/9 "2012-09-24T10:11:16Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![yfede](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/yfede/32/506_2.png) [@yfede](https://forum.juce.com/u/yfede)\
**Post date:** [September 24, 2012, 10:12am UTC](https://forum.juce.com/t/warning-reports/9270/10 "2012-09-24T10:12:07Z")

</div>

juce\_MidiDataConcatenator.h, line 66

```auto

```

shadows the argument to pushMidiData with the same name

---

<div class="post-metadata">

**Author:** ![yfede](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/yfede/32/506_2.png) [@yfede](https://forum.juce.com/u/yfede)\
**Post date:** [September 24, 2012, 10:13am UTC](https://forum.juce.com/t/warning-reports/9270/11 "2012-09-24T10:13:35Z")

</div>

juce\_AudioFormatWriter.cpp, line 173:

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

the numChannel argument shadows a member of AudioFormatWriter class

---

<div class="post-metadata">

**Author:** ![yfede](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/yfede/32/506_2.png) [@yfede](https://forum.juce.com/u/yfede)\
**Post date:** [September 24, 2012, 10:15am UTC](https://forum.juce.com/t/warning-reports/9270/12 "2012-09-24T10:15:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![yfede](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/yfede/32/506_2.png) [@yfede](https://forum.juce.com/u/yfede)\
**Post date:** [September 24, 2012, 10:17am UTC](https://forum.juce.com/t/warning-reports/9270/13 "2012-09-24T10:17:23Z")

</div>

juce\_VST\_Wrapper.cpp,

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)  
{  
initialiseMac();  
return pluginEntryPoint (audioMaster);  
}

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

```

[/code]

prototypes for these functions are missing

---

<div class="post-metadata">

**Author:** ![yfede](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/yfede/32/506_2.png) [@yfede](https://forum.juce.com/u/yfede)\
**Post date:** [September 24, 2012, 10:20am UTC](https://forum.juce.com/t/warning-reports/9270/14 "2012-09-24T10:20:54Z")

</div>

juce\_AudioThumbnail.cpp

line 316:

```auto

```

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

---

<div class="post-metadata">

**Author:** ![yfede](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/yfede/32/506_2.png) [@yfede](https://forum.juce.com/u/yfede)\
**Post date:** [September 24, 2012, 10:27am UTC](https://forum.juce.com/t/warning-reports/9270/15 "2012-09-24T10:27:40Z")

</div>

in juce\_VST\_Wrapper.mm

Prototypes are missing for the following functions:

```auto

```

```auto

```

```auto

```

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?)

```auto

```

some arguments are unused in some builds

```auto

```

some arguments are unused in some builds

```auto

```

some arguments are unused in some builds

---

<div class="post-metadata">

**Author:** ![yfede](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/yfede/32/506_2.png) [@yfede](https://forum.juce.com/u/yfede)\
**Post date:** [September 24, 2012, 10:33am UTC](https://forum.juce.com/t/warning-reports/9270/16 "2012-09-24T10:33:26Z")

</div>

in juce\_AU\_Wrapper.mm

line 770:

```auto

```

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

```auto

```

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:

```auto

```

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,
                          juceFilterObjectPropertyID,
                          kAudioUnitScope_Global,
                          0,
                          pointers,
                          &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);

```

}  
[/code]

unused parameter inPreferredSize

---

<div class="post-metadata">

**Author:** ![yfede](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/yfede/32/506_2.png) [@yfede](https://forum.juce.com/u/yfede)\
**Post date:** [September 24, 2012, 10:39am UTC](https://forum.juce.com/t/warning-reports/9270/17 "2012-09-24T10:39:45Z")

</div>

juce\_RTAS\_MacUtilities.mm

missing prototypes for these funcions:

```auto

```

```auto

```

```auto

```

```auto

```

line 67:

```auto

```

this local variable is used nowhere

---

<div class="post-metadata">

**Author:** ![yfede](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/yfede/32/506_2.png) [@yfede](https://forum.juce.com/u/yfede)\
**Post date:** [September 24, 2012, 10:41am UTC](https://forum.juce.com/t/warning-reports/9270/18 "2012-09-24T10:41:39Z")

</div>

juce\_Expression.cpp

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

Plus this happens also on line 816:

```auto

```

---

<div class="post-metadata">

**Author:** ![yfede](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/yfede/32/506_2.png) [@yfede](https://forum.juce.com/u/yfede)\
**Post date:** [September 24, 2012, 10:43am UTC](https://forum.juce.com/t/warning-reports/9270/19 "2012-09-24T10:43:42Z")

</div>

juce\_Socket.cpp

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

line 78:

```auto

```

line 204:

```auto

```

line 396:

```auto

```

---

<div class="post-metadata">

**Author:** ![yfede](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/yfede/32/506_2.png) [@yfede](https://forum.juce.com/u/yfede)\
**Post date:** [September 24, 2012, 10:45am UTC](https://forum.juce.com/t/warning-reports/9270/20 "2012-09-24T10:45:21Z")

</div>

juce\_LocalisedStrings.cpp, line 183:

```auto

```

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

[Next page](https://forum.juce.com/t/warning-reports/9270.md?page=2)
