Compilation warning with clang 3.5.1


#1

Hi,

 

I'm cross compiling juce for osx on linux using clang 3.5.1.

I get this compiler warning, which seems correct to me, but I don't know objective c or osx programming very well:

 

+ o64-clang -x objective-c++ -arch x86_64 -Wall -fmessage-length=0 -std=c++11 -fpascal-strings -O3 -Wreturn-type -Wnon-virtual-dtor -Wformat -Wno-missing-braces -Wparentheses -Wswitch -Wunused-variable -Wunused-value -D_DEBUG=1 -DDEBUG=1 -DJUCER_XCODE_MAC_F6D2F4CF=1 -DJUCE_APP_VERSION=1.0.0 -DJUCE_APP_VERSION_HEX=0x10000 -fasm-blocks -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -Winvalid-offsetof -mmacosx-version-min=10.7 -g -Wno-sign-conversion -iquote /home/kjetil/radium/pluginhost/Builds/MacOSX/build/MyPluginHost.build/Release/MyPluginHost.build/MyPluginHost-generated-files.hmap -I/home/kjetil/radium/pluginhost/Builds/MacOSX/build/MyPluginHost.build/Release/MyPluginHost.build/MyPluginHost-own-target-headers.hmap -I/home/kjetil/radium/pluginhost/Builds/MacOSX/build/MyPluginHost.build/Release/MyPluginHost.build/MyPluginHost-all-target-headers.hmap -iquote /home/kjetil/radium/pluginhost/Builds/MacOSX/build/MyPluginHost.build/Release/MyPluginHost.build/MyPluginHost-project-headers.hmap -I/home/kjetil/radium/pluginhost/Builds/MacOSX/build/Release/include -I../../JuceLibraryCode -I../../JuceLibraryCode/modules -I/home/kjetil/SDKs/vstsdk2.4 -I/home/kjetil/radium/pluginhost/Builds/MacOSX/build/MyPluginHost.build/Release/MyPluginHost.build/DerivedSources/x86_64 -I/home/kjetil/radium/pluginhost/Builds/MacOSX/build/MyPluginHost.build/Release/MyPluginHost.build/DerivedSources -Wreorder -F/home/kjetil/radium/pluginhost/Builds/MacOSX/build/Release -DNOPAUSEPLAY -DCOMPILING_RADIUM -DGUIISQT -DUSE_GFX_OP_QUEUE -DFULL_VERSION=1 -DIS_LITTLE_ENDIAN=1 -DUSE_OPENGL=1 -DUSE_QT_VISUAL=1 -DUSE_GTK_VISUAL=0 -DUSE_QT_REQTYPE=1 -DUSE_GTK_REQTYPE=0 -DUSE_QT_MENU=1 -DUSE_GTK_MENU=0 -MMD -MT dependencies -MF /home/kjetil/radium/pluginhost/Builds/MacOSX/build/MyPluginHost.build/Release/MyPluginHost.build/Objects-normal/x86_64/juce_audio_processors.d --serialize-diagnostics /home/kjetil/radium/pluginhost/Builds/MacOSX/build/MyPluginHost.build/Release/MyPluginHost.build/Objects-normal/x86_64/juce_audio_processors.dia -c ../../JuceLibraryCode/modules/juce_graphics/juce_graphics.mm -o objects/juce_graphics.o
In file included from ../../JuceLibraryCode/modules/juce_graphics/juce_graphics.mm:25:
In file included from ../../JuceLibraryCode/modules/juce_graphics/juce_graphics.cpp:137:
../../JuceLibraryCode/modules/juce_graphics/native/juce_mac_CoreGraphicsContext.mm:510:13: warning: comparison of function 'CGContextDrawTiledImage' not equal to a null pointer is always true [-Wtautological-pointer-compare]
        if (CGContextDrawTiledImage != 0 && transform.isOnlyTranslation())
            ^~~~~~~~~~~~~~~~~~~~~~~    ~
../../JuceLibraryCode/modules/juce_graphics/native/juce_mac_CoreGraphicsContext.mm:510:13: note: prefix with the address-of operator to silence this warning
        if (CGContextDrawTiledImage != 0 && transform.isOnlyTranslation())
            ^
            &
1 warning generated.

 

 

It's far from from unlikely that my compilation options are wrong (they are based on the result of running "xcodebuild -verbose"), so I would also appreciate to know if this warning is completely wrong.

 

Thanks


#2

What compiler flags did you enable in order to get that warning?


#3

I think I posted all the compiler flags...

 

EDIT:  BTW. "o64-clang" is the clang cross compiler (https://github.com/tpoechtrager/osxcross)


#4

Yes, I should have said "which are the relevant compiler flags?" Because I've tried enabled all kinds of warning flags, but haven't ever seen that warning.


#5

Oh. The relevant compilation flag is "-Wtautological-pointer-compare", which is a new warning in clang 3.5:

http://llvm.org/releases/3.5.0/tools/clang/docs/ReleaseNotes.html

I think it's enabled with -Wall. (It's actually written in the console output I posted that the warning was caused by "-Wtautological-pointer-compare", but I guess it's hard to see in the wall of text .)

 


#6

Ok, thanks, I'll add that to my warnings list!