[LLVMbugs] [Bug 23347] New: Don't issue -Wtautological-pointer-compare with -weak_framework

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Apr 25 05:48:44 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=23347

            Bug ID: 23347
           Summary: Don't issue -Wtautological-pointer-compare with
                    -weak_framework
           Product: clang
           Version: 3.6
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ilya.konstantinov at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The recommended way to check for symbols of a framework linked with
"-weak_framework" is:

  if (MyWeakLinkedFunction != NULL) {
    ...
  }

This is according to Apple docs:
https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/WeakLinking.html

However, recent clang version (from Xcode 6.3.1) say:

  error: comparison of function 'MyWeakLinkedFunction' not equal to a null
pointer is always true [-Werror,-Wtautological-pointer-compare]
  if (MyWeakLinkedFunction != NULL) {
      ^~~~~~~~~~~~~~~~~~~~~~~~~~    ~~~~
  note: prefix with the address-of operator to silence this warning
  if (MyWeakLinkedFunction != NULL) {
      ^
      &

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150425/032b2047/attachment.html>


More information about the llvm-bugs mailing list