http://llvm.org/bugs/show_bug.cgi?id=13715

             Bug #: 13715
           Summary: null-conversion warning needs to be suppressed in
                    macro expansion
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified


Macros can accept pointer-like arguments which they would check for
non-null-ness using operator!.  Currently clang warns in those cases, but I
don't think that warning in macro expansion contexts makes a lot of sense.

ehsan@teenux:/tmp$ cat test.cpp 
#include <stdio.h>
#define foo(x) if (!(x)) printf("x");
int main() {
  int* p;
  foo(p);
  foo(NULL);
}
ehsan@teenux:/tmp$ clang -Wnull-conversion test.cpp 
test.cpp:6:3: warning: implicit conversion of NULL constant to 'bool'
[-Wnull-conversion]
  foo(NULL);
  ^~~~~~~~~
test.cpp:2:22: note: expanded from macro 'foo'
#define foo(x) if (!(x)) printf("x");
                   ~ ^
1 warning generated.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to