I tried to build opencv 2.4.10 on Mac 10.10.3 with Xcode 6.3. And the following errors occurred by building.
/Users/Shirui/work/program/opencv-2.4.10/modules/legacy/src/
I'm told that you can disable the warning globally by adding -Wno-tautological-pointer-compare to your compiler flags, or on a one-off basis by wrapping the variable you're testing in parentheses.
That's actually a problem that happens when building OpencV with clang.
It was first discussed here, and fixed here.
You can do the fix youself, of course, or just download a more recent version of OpenCV.