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

             Bug #: 12761
           Summary: -Wformat warns about printf("%hhu", 'a'); with
                    -funsigned-char
           Product: clang
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]
    Classification: Unclassified


#include <stdio.h>

void f(char c) {
  printf("%hhu", 'a');
}

$ clang -fsyntax-only -Wformat -funsigned-char a.cc

a.cc:4:14: warning: format specifies type 'unsigned char' but the argument has
      type 'char' [-Wformat]
  printf("%hhu", 'a');
          ~~~^   ~~~
          %hhu


So, even though 'a' in this case is an unsigned char, it warns, and it provides
a fixit that doesn't help.


For "%hhx" it doesn't preserve the "x" in the fixit, but suggests "%hhu".

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